Skip to content

Commit fd08c12

Browse files
test: fix ITDatabaseAdminTest failures (#2976)
* test: fix ITDatabaseAdminTest failures * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * exclude owlbot pre-processor run on kokoro config * remove reduntant assert * fix test --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a23d89f commit fd08c12

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
import java.util.Optional;
4848
import java.util.concurrent.ExecutionException;
4949
import java.util.concurrent.TimeUnit;
50+
import java.util.concurrent.TimeoutException;
5051
import java.util.logging.Level;
5152
import java.util.logging.Logger;
53+
import org.junit.Assert;
5254
import org.junit.Before;
5355
import org.junit.ClassRule;
5456
import org.junit.Test;
@@ -260,9 +262,14 @@ public void updateDatabaseInvalidFieldsToUpdate() {
260262
OperationFuture<Database, UpdateDatabaseMetadata> op =
261263
dbAdminClient.updateDatabase(databaseToUpdate);
262264

263-
ExecutionException e =
264-
assertThrows(ExecutionException.class, () -> op.get(5, TimeUnit.MINUTES));
265-
assertThat(e.getMessage()).contains("Invalid field mask");
265+
try {
266+
op.get(5, TimeUnit.MINUTES);
267+
Assert.fail("No exception thrown");
268+
} catch (ExecutionException | InterruptedException | TimeoutException e) {
269+
Assert.assertTrue(e.getCause() instanceof SpannerException);
270+
SpannerException exception = ((SpannerException) e.getCause());
271+
assertEquals(ErrorCode.INVALID_ARGUMENT, exception.getErrorCode());
272+
}
266273
}
267274

268275
@Test

owlbot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
excludes=[
2626
".kokoro/continuous/common.cfg",
2727
".kokoro/nightly/common.cfg",
28+
".kokoro/nightly/integration.cfg",
2829
".kokoro/nightly/java8-samples.cfg",
2930
".kokoro/nightly/java11-samples.cfg",
3031
".kokoro/nightly/samples.cfg",

0 commit comments

Comments
 (0)