@@ -145,27 +145,37 @@ public void updateInstanceWithAutoscalingConfig() throws Exception {
145
145
.setNodeCount (0 )
146
146
.setAutoscalingConfig (autoscalingConfig )
147
147
.build ();
148
- OperationFuture <Instance , UpdateInstanceMetadata > op =
149
- instanceClient .updateInstance (toUpdate , InstanceInfo .InstanceField .AUTOSCALING_CONFIG );
150
- Instance newInstance = op .get ();
151
- assertThat (newInstance .getAutoscalingConfig ()).isEqualTo (autoscalingConfig );
152
-
153
- Instance newInstanceFromGet =
154
- instanceClient .getInstance (env .getTestHelper ().getInstanceId ().getInstance ());
155
- assertThat (newInstanceFromGet ).isEqualTo (newInstance );
156
-
157
- // Revert back to the instance original state.
158
- toUpdate =
159
- InstanceInfo .newBuilder (instance .getId ())
160
- .setAutoscalingConfig (null )
161
- .setNodeCount (instance .getNodeCount ())
162
- .build ();
163
- instanceClient
164
- .updateInstance (
165
- toUpdate ,
166
- InstanceInfo .InstanceField .AUTOSCALING_CONFIG ,
167
- InstanceInfo .InstanceField .NODE_COUNT )
168
- .get ();
148
+ try {
149
+ OperationFuture <Instance , UpdateInstanceMetadata > op =
150
+ instanceClient .updateInstance (toUpdate , InstanceInfo .InstanceField .AUTOSCALING_CONFIG );
151
+ Instance newInstance = op .get ();
152
+ assertThat (newInstance .getAutoscalingConfig ()).isEqualTo (autoscalingConfig );
153
+
154
+ Instance newInstanceFromGet =
155
+ instanceClient .getInstance (env .getTestHelper ().getInstanceId ().getInstance ());
156
+ assertThat (newInstanceFromGet ).isEqualTo (newInstance );
157
+
158
+ // Revert back to the instance original state.
159
+ toUpdate =
160
+ InstanceInfo .newBuilder (instance .getId ())
161
+ .setAutoscalingConfig (null )
162
+ .setNodeCount (instance .getNodeCount ())
163
+ .build ();
164
+ instanceClient
165
+ .updateInstance (
166
+ toUpdate ,
167
+ InstanceInfo .InstanceField .AUTOSCALING_CONFIG ,
168
+ InstanceInfo .InstanceField .NODE_COUNT )
169
+ .get ();
170
+ } catch (Exception exception ) {
171
+ // TODO: Remove once the client lib supports creating instances with an Edition.
172
+ if (!exception
173
+ .getMessage ()
174
+ .contains ("The minimum required Edition for this feature is ENTERPRISE." )) {
175
+ throw exception ;
176
+ }
177
+ // ignore this error for now.
178
+ }
169
179
}
170
180
171
181
@ Test
0 commit comments