diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnDifferentGrpcChannelMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnDifferentGrpcChannelMockServerTest.java index 267c6077ad..c436947336 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnDifferentGrpcChannelMockServerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnDifferentGrpcChannelMockServerTest.java @@ -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 { @@ -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() @@ -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( @@ -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. @@ -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 = @@ -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(); + } }