Skip to content

build: ignore editions errors in InstanceAdmin tests #3360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 2, 2024
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