File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
google-cloud-spanner/src/test/java/com/google/cloud/spanner Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -3142,15 +3142,20 @@ public void testDatabaseOrInstanceDoesNotExistOnCreate() {
31423142 .readWriteTransaction ()
31433143 .run (transaction -> transaction .executeUpdate (UPDATE_STATEMENT )));
31443144 // No additional requests should have been sent by the client.
3145- // Note that in case of the use of multiplexed sessions, then we have 2 requests:
3146- // Note that in case of the use of regular sessions, then we have 1 request:
3147- // 1. BatchCreateSessions for the session pool.
3148- // 2. CreateSession for the multiplexed session.
3149- assertThat (mockSpanner .getRequests ())
3150- .hasSize (
3151- spanner .getOptions ().getSessionPoolOptions ().getUseMultiplexedSession ()
3152- ? 2
3153- : 1 );
3145+ if (spanner .getOptions ().getSessionPoolOptions ().getUseMultiplexedSession ()
3146+ && !spanner .getOptions ().getSessionPoolOptions ().getUseMultiplexedSessionForRW ()) {
3147+ // Note that in case of the use of multiplexed sessions for read-only alone, then we
3148+ // have 2 requests:
3149+ // 1. BatchCreateSessions for the session pool.
3150+ // 2. CreateSession for the multiplexed session.
3151+ assertThat (mockSpanner .getRequests ()).hasSize (2 );
3152+ } else {
3153+ // Note that in case of the use of regular sessions, then we have 1 request:
3154+ // BatchCreateSessions for the session pool.
3155+ // Note that in case of the use of multiplexed sessions for read-write, then we have 1
3156+ // request: CreateSession for the multiplexed session.
3157+ assertThat (mockSpanner .getRequests ()).hasSize (1 );
3158+ }
31543159 }
31553160 }
31563161 mockSpanner .reset ();
Original file line number Diff line number Diff line change 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 ;
5960import org .junit .Test ;
6061import org .junit .runner .RunWith ;
6162import org .junit .runners .JUnit4 ;
62- import static org .junit .Assume .assumeFalse ;
6363
6464@ RunWith (JUnit4 .class )
6565public class RetryOnDifferentGrpcChannelMockServerTest extends AbstractMockServerTest {
You can’t perform that action at this time.
0 commit comments