2222import static org .junit .Assert .assertNotEquals ;
2323import static org .junit .Assert .assertThrows ;
2424import static org .junit .Assert .assertTrue ;
25+ import static org .junit .Assume .assumeFalse ;
2526
2627import com .google .cloud .NoCredentials ;
2728import com .google .cloud .spanner .MockSpannerServiceImpl .SimulatedExecutionTime ;
@@ -133,6 +134,9 @@ public void testReadWriteTransaction_retriesOnNewChannel() {
133134 AtomicInteger attempts = new AtomicInteger ();
134135
135136 try (Spanner spanner = builder .build ().getService ()) {
137+ assumeFalse (
138+ "RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions" ,
139+ isMultiplexedSessionsEnabledForRW (spanner ));
136140 DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
137141 client
138142 .readWriteTransaction ()
@@ -168,6 +172,9 @@ public void testReadWriteTransaction_stopsRetrying() {
168172 SimulatedExecutionTime .ofStickyException (Status .DEADLINE_EXCEEDED .asRuntimeException ()));
169173
170174 try (Spanner spanner = builder .build ().getService ()) {
175+ assumeFalse (
176+ "RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions" ,
177+ isMultiplexedSessionsEnabledForRW (spanner ));
171178 DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
172179 SpannerException exception =
173180 assertThrows (
@@ -211,6 +218,9 @@ public void testDenyListedChannelIsCleared() {
211218 SimulatedExecutionTime .ofStickyException (Status .DEADLINE_EXCEEDED .asRuntimeException ()));
212219
213220 try (Spanner spanner = builder .build ().getService ()) {
221+ assumeFalse (
222+ "RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions" ,
223+ isMultiplexedSessionsEnabledForRW (spanner ));
214224 DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
215225
216226 // Retry until all channels have been deny-listed.
@@ -339,6 +349,9 @@ public void testReadWriteTransaction_withGrpcContextDeadline_doesNotRetry() {
339349 SimulatedExecutionTime .ofMinimumAndRandomTime (500 , 500 ));
340350
341351 try (Spanner spanner = builder .build ().getService ()) {
352+ assumeFalse (
353+ "RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions" ,
354+ isMultiplexedSessionsEnabledForRW (spanner ));
342355 DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
343356 ScheduledExecutorService service = Executors .newScheduledThreadPool (1 );
344357 Context context =
@@ -365,4 +378,11 @@ public void testReadWriteTransaction_withGrpcContextDeadline_doesNotRetry() {
365378 // up.
366379 assertEquals (1 , mockSpanner .countRequestsOfType (BeginTransactionRequest .class ));
367380 }
381+
382+ private boolean isMultiplexedSessionsEnabledForRW (Spanner spanner ) {
383+ if (spanner .getOptions () == null || spanner .getOptions ().getSessionPoolOptions () == null ) {
384+ return false ;
385+ }
386+ return spanner .getOptions ().getSessionPoolOptions ().getUseMultiplexedSessionForRW ();
387+ }
368388}
0 commit comments