@@ -171,6 +171,9 @@ public void testIgnoreLeakedSession() {
171171
172172 @ Test
173173 public void testReadWriteTransactionExceptionOnCreateSession () {
174+ assumeFalse (
175+ "Session Leaks do not occur with Multiplexed Sessions" ,
176+ isMultiplexedSessionsEnabledForRW ());
174177 readWriteTransactionTest (
175178 () ->
176179 mockSpanner .setBatchCreateSessionsExecutionTime (
@@ -180,6 +183,9 @@ public void testReadWriteTransactionExceptionOnCreateSession() {
180183
181184 @ Test
182185 public void testReadWriteTransactionExceptionOnBegin () {
186+ assumeFalse (
187+ "Session Leaks do not occur with Multiplexed Sessions" ,
188+ isMultiplexedSessionsEnabledForRW ());
183189 readWriteTransactionTest (
184190 () ->
185191 mockSpanner .setBeginTransactionExecutionTime (
@@ -200,6 +206,9 @@ private void readWriteTransactionTest(
200206
201207 @ Test
202208 public void testTransactionManagerExceptionOnCreateSession () {
209+ assumeFalse (
210+ "Session Leaks do not occur with Multiplexed Sessions" ,
211+ isMultiplexedSessionsEnabledForRW ());
203212 transactionManagerTest (
204213 () ->
205214 mockSpanner .setBatchCreateSessionsExecutionTime (
@@ -209,6 +218,9 @@ public void testTransactionManagerExceptionOnCreateSession() {
209218
210219 @ Test
211220 public void testTransactionManagerExceptionOnBegin () {
221+ assumeFalse (
222+ "Session Leaks do not occur with Multiplexed Sessions" ,
223+ isMultiplexedSessionsEnabledForRW ());
212224 assertThat (pool .getNumberOfSessionsInPool (), is (equalTo (0 )));
213225 mockSpanner .setBeginTransactionExecutionTime (
214226 SimulatedExecutionTime .ofException (FAILED_PRECONDITION ));
@@ -229,4 +241,11 @@ private void transactionManagerTest(Runnable setup, int expectedNumberOfSessions
229241 }
230242 assertEquals (expectedNumberOfSessionsAfterExecution , pool .getNumberOfSessionsInPool ());
231243 }
244+
245+ private boolean isMultiplexedSessionsEnabledForRW () {
246+ if (spanner .getOptions () == null || spanner .getOptions ().getSessionPoolOptions () == null ) {
247+ return false ;
248+ }
249+ return spanner .getOptions ().getSessionPoolOptions ().getUseMultiplexedSessionForRW ();
250+ }
232251}
0 commit comments