Skip to content

Commit

Permalink
chore: generate libraries at Mon Nov 4 14:31:54 UTC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
cloud-java-bot committed Nov 4, 2024
1 parent 8a11bbd commit 2b1ce05
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ public void testExecuteQueryRequestsIgnoreOverriddenMaxAttempts() throws IOExcep
.executeQuerySettings()
.setRetrySettings(RetrySettings.newBuilder().setMaxAttempts(10).build());

try (EnhancedBigtableStub overrideStub = EnhancedBigtableStub.create(overrideSettings.build().getStubSettings())) {
SqlServerStream stream = overrideStub.executeQueryCallable().call(Statement.of("SELECT * FROM table"));
Iterator<SqlRow> iterator = stream.rows().iterator();

assertThrows(UnavailableException.class, iterator::next).getCause();
assertThat(fakeService.attempts).isEqualTo(1);
}
try (EnhancedBigtableStub overrideStub =
EnhancedBigtableStub.create(overrideSettings.build().getStubSettings())) {
SqlServerStream stream =
overrideStub.executeQueryCallable().call(Statement.of("SELECT * FROM table"));
Iterator<SqlRow> iterator = stream.rows().iterator();

assertThrows(UnavailableException.class, iterator::next).getCause();
assertThat(fakeService.attempts).isEqualTo(1);
}
}

@Test
Expand Down Expand Up @@ -160,12 +162,14 @@ public void testExecuteQueryRequestsRespectDeadline() throws IOException {
.setMaxRpcTimeout(Duration.ofMillis(10))
.build());

try (EnhancedBigtableStub overrideDeadline = EnhancedBigtableStub.create(overrideSettings.build().getStubSettings())) {
SqlServerStream streamOverride = overrideDeadline.executeQueryCallable().call(Statement.of("SELECT * FROM table"));
Iterator<SqlRow> overrideIterator = streamOverride.rows().iterator();
// We don't care about this but are reusing the fake service that tests retries
assertThrows(DeadlineExceededException.class, overrideIterator::next).getCause();
}
try (EnhancedBigtableStub overrideDeadline =
EnhancedBigtableStub.create(overrideSettings.build().getStubSettings())) {
SqlServerStream streamOverride =
overrideDeadline.executeQueryCallable().call(Statement.of("SELECT * FROM table"));
Iterator<SqlRow> overrideIterator = streamOverride.rows().iterator();
// We don't care about this but are reusing the fake service that tests retries
assertThrows(DeadlineExceededException.class, overrideIterator::next).getCause();
}
}

private static class FakeService extends BigtableGrpc.BigtableImplBase {
Expand Down

0 comments on commit 2b1ce05

Please sign in to comment.