Skip to content

Commit

Permalink
tests: add test for retry on UNAVAILABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed May 14, 2020
1 parent afbb2c4 commit aac7cf7
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -324,6 +324,23 @@ public Long run(TransactionContext transaction) throws Exception {
}
}

@Test
public void testPartitionedDmlRetriesOnUnavailable() throws Exception {
mockSpanner.setExecuteSqlExecutionTime(
SimulatedExecutionTime.ofException(Status.UNAVAILABLE.asRuntimeException()));
SpannerOptions.Builder builder =
SpannerOptions.newBuilder()
.setProjectId(TEST_PROJECT)
.setChannelProvider(channelProvider)
.setCredentials(NoCredentials.getInstance());
try (Spanner spanner = builder.build().getService()) {
DatabaseClient client =
spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE));
long updateCount = client.executePartitionedUpdate(UPDATE_STATEMENT);
assertThat(updateCount).isEqualTo(UPDATE_COUNT);
}
}

@Test
public void testDatabaseOrInstanceDoesNotExistOnPrepareSession() throws Exception {
StatusRuntimeException[] exceptions =
Expand Down

0 comments on commit aac7cf7

Please sign in to comment.