Skip to content

Commit 51de93c

Browse files
build: ignore editions errors in InstanceAdmin tests (#3360)
* build: ignore editions errors in InstanceAdmin tests * chore: generate libraries at Wed Oct 2 13:14:01 UTC 2024 * fix: catch all exception types --------- Co-authored-by: cloud-java-bot <[email protected]>
1 parent 72bb67f commit 51de93c

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>libraries-bom</artifactId>
22-
<version>26.45.0</version>
22+
<version>26.47.0</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -145,27 +145,37 @@ public void updateInstanceWithAutoscalingConfig() throws Exception {
145145
.setNodeCount(0)
146146
.setAutoscalingConfig(autoscalingConfig)
147147
.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+
}
169179
}
170180

171181
@Test

0 commit comments

Comments
 (0)