Skip to content

Commit

Permalink
Make the errors a flexible retry
Browse files Browse the repository at this point in the history
  • Loading branch information
nancyxu123 committed Oct 2, 2023
1 parent 1c68481 commit d47d42f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void testUnavailableExceptionRetries() throws InterruptedException {
// databaseClient.getDialect does not currently bubble up the correct message.
// Instead, the error returned is: "DEADLINE_EXCEEDED: Operation did not complete "
// "in the given time"
thrown.expectMessage("DEADLINE_EXCEEDED: Operation did not complete in the given time");
thrown.expectMessage("DEADLINE_EXCEEDED");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
}
Expand Down Expand Up @@ -184,7 +184,7 @@ public void testAbortedExceptionRetries() throws InterruptedException {
// The pipeline continues making requests to Spanner to retry the Aborted errors.
assertNull(result.waitUntilFinish(Duration.millis(500)));
} finally {
thrown.expectMessage("DEADLINE_EXCEEDED: Operation did not complete in the given time");
thrown.expectMessage("DEADLINE_EXCEEDED");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
}
Expand All @@ -211,7 +211,7 @@ public void testUnknownExceptionDoesNotRetry() {
pipeline.run().waitUntilFinish();
} finally {
thrown.expect(SpannerException.class);
thrown.expectMessage("UNKNOWN - Statement: 'SELECT 'POSTGRESQL' AS DIALECT");
thrown.expectMessage("UNKNOWN");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
}
Expand All @@ -238,7 +238,7 @@ public void testResourceExhaustedRetry() {
.withInclusiveEndAt(endTimestamp));
pipeline.run().waitUntilFinish();
} finally {
thrown.expectMessage("DEADLINE_EXCEEDED: Operation did not complete in the given time");
thrown.expectMessage("DEADLINE_EXCEEDED");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
}
Expand Down Expand Up @@ -274,7 +274,7 @@ public void testResourceExhaustedRetryWithDefaultSettings() {
pipeline.run().waitUntilFinish();
} finally {
thrown.expect(SpannerException.class);
thrown.expectMessage("RESOURCE_EXHAUSTED - Statement: 'SELECT 'POSTGRESQL' AS DIALECT");
thrown.expectMessage("RESOURCE_EXHAUSTED");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
}
Expand Down Expand Up @@ -315,7 +315,7 @@ public void testInvalidRecordReceived() {
thrown.expect(SpannerException.class);
// DatabaseClient.getDialect returns "DEADLINE_EXCEEDED: Operation did not complete in the "
// given time" even though we mocked it out.
thrown.expectMessage("DEADLINE_EXCEEDED: Operation did not complete in the given time");
thrown.expectMessage("DEADLINE_EXCEEDED");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
}
Expand Down

0 comments on commit d47d42f

Please sign in to comment.