Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.45.0</version>
<version>26.47.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,37 @@ public void updateInstanceWithAutoscalingConfig() throws Exception {
.setNodeCount(0)
.setAutoscalingConfig(autoscalingConfig)
.build();
OperationFuture<Instance, UpdateInstanceMetadata> op =
instanceClient.updateInstance(toUpdate, InstanceInfo.InstanceField.AUTOSCALING_CONFIG);
Instance newInstance = op.get();
assertThat(newInstance.getAutoscalingConfig()).isEqualTo(autoscalingConfig);

Instance newInstanceFromGet =
instanceClient.getInstance(env.getTestHelper().getInstanceId().getInstance());
assertThat(newInstanceFromGet).isEqualTo(newInstance);

// Revert back to the instance original state.
toUpdate =
InstanceInfo.newBuilder(instance.getId())
.setAutoscalingConfig(null)
.setNodeCount(instance.getNodeCount())
.build();
instanceClient
.updateInstance(
toUpdate,
InstanceInfo.InstanceField.AUTOSCALING_CONFIG,
InstanceInfo.InstanceField.NODE_COUNT)
.get();
try {
OperationFuture<Instance, UpdateInstanceMetadata> op =
instanceClient.updateInstance(toUpdate, InstanceInfo.InstanceField.AUTOSCALING_CONFIG);
Instance newInstance = op.get();
assertThat(newInstance.getAutoscalingConfig()).isEqualTo(autoscalingConfig);

Instance newInstanceFromGet =
instanceClient.getInstance(env.getTestHelper().getInstanceId().getInstance());
assertThat(newInstanceFromGet).isEqualTo(newInstance);

// Revert back to the instance original state.
toUpdate =
InstanceInfo.newBuilder(instance.getId())
.setAutoscalingConfig(null)
.setNodeCount(instance.getNodeCount())
.build();
instanceClient
.updateInstance(
toUpdate,
InstanceInfo.InstanceField.AUTOSCALING_CONFIG,
InstanceInfo.InstanceField.NODE_COUNT)
.get();
} catch (Exception exception) {
// TODO: Remove once the client lib supports creating instances with an Edition.
if (!exception
.getMessage()
.contains("The minimum required Edition for this feature is ENTERPRISE.")) {
throw exception;
}
// ignore this error for now.
}
}

@Test
Expand Down
Loading