Skip to content

Commit

Permalink
chore(spanner): skip RetryOnDifferentGrpcChannelMockServerTest for mu…
Browse files Browse the repository at this point in the history
…x read-write as it is not handled
  • Loading branch information
harshachinta committed Jan 10, 2025
1 parent bf861ca commit 3a473ac
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assume.assumeFalse;

@RunWith(JUnit4.class)
public class RetryOnDifferentGrpcChannelMockServerTest extends AbstractMockServerTest {
Expand Down Expand Up @@ -133,6 +134,9 @@ public void testReadWriteTransaction_retriesOnNewChannel() {
AtomicInteger attempts = new AtomicInteger();

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
client
.readWriteTransaction()
Expand Down Expand Up @@ -168,6 +172,9 @@ public void testReadWriteTransaction_stopsRetrying() {
SimulatedExecutionTime.ofStickyException(Status.DEADLINE_EXCEEDED.asRuntimeException()));

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
SpannerException exception =
assertThrows(
Expand Down Expand Up @@ -211,6 +218,9 @@ public void testDenyListedChannelIsCleared() {
SimulatedExecutionTime.ofStickyException(Status.DEADLINE_EXCEEDED.asRuntimeException()));

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));

// Retry until all channels have been deny-listed.
Expand Down Expand Up @@ -339,6 +349,9 @@ public void testReadWriteTransaction_withGrpcContextDeadline_doesNotRetry() {
SimulatedExecutionTime.ofMinimumAndRandomTime(500, 500));

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
Context context =
Expand All @@ -365,4 +378,11 @@ public void testReadWriteTransaction_withGrpcContextDeadline_doesNotRetry() {
// up.
assertEquals(1, mockSpanner.countRequestsOfType(BeginTransactionRequest.class));
}

private boolean isMultiplexedSessionsEnabledForRW(Spanner spanner) {
if (spanner.getOptions() == null || spanner.getOptions().getSessionPoolOptions() == null) {
return false;
}
return spanner.getOptions().getSessionPoolOptions().getUseMultiplexedSessionForRW();
}
}

0 comments on commit 3a473ac

Please sign in to comment.