@@ -3441,7 +3441,8 @@ func TestMaxSessions(t *testing.T) {
34413441}
34423442
34433443func TestClientReuse (t * testing.T ) {
3444- t .Parallel ()
3444+ // MinSessions only has an effect if we are not using multiplexed sessions.
3445+ t .Setenv ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS" , "false" )
34453446
34463447 ctx := context .Background ()
34473448 db , server , teardown := setupTestDBConnectionWithParams (t , "minSessions=2" )
@@ -3499,7 +3500,8 @@ func TestClientReuse(t *testing.T) {
34993500}
35003501
35013502func TestStressClientReuse (t * testing.T ) {
3502- t .Parallel ()
3503+ // MinSessions only has an effect if we are not using multiplexed sessions.
3504+ t .Setenv ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS" , "false" )
35033505
35043506 ctx := context .Background ()
35053507 _ , server , teardown := setupTestDBConnection (t )
@@ -4285,7 +4287,8 @@ func TestTag_RunTransactionWithOptions_IsNotSticky(t *testing.T) {
42854287}
42864288
42874289func TestMaxIdleConnectionsNonZero (t * testing.T ) {
4288- t .Parallel ()
4290+ // MinSessions only has an effect if we are not using multiplexed sessions.
4291+ t .Setenv ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS" , "false" )
42894292
42904293 // Set MinSessions=1, so we can use the number of BatchCreateSessions requests as an indication
42914294 // of the number of clients that was created.
@@ -4307,7 +4310,8 @@ func TestMaxIdleConnectionsNonZero(t *testing.T) {
43074310}
43084311
43094312func TestMaxIdleConnectionsZero (t * testing.T ) {
4310- t .Parallel ()
4313+ // MinSessions only has an effect if we are not using multiplexed sessions.
4314+ t .Setenv ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS" , "false" )
43114315
43124316 // Set MinSessions=1, so we can use the number of BatchCreateSessions requests as an indication
43134317 // of the number of clients that was created.
@@ -4353,9 +4357,16 @@ func openAndCloseConn(t *testing.T, db *sql.DB) {
43534357func TestCannotReuseClosedConnector (t * testing.T ) {
43544358 // Note: This test cannot be parallel, as it inspects the size of the shared
43554359 // map of connectors in the driver. There is no guarantee how many connectors
4356- // will be open when the test is running, if there are also other tests running
4360+ // will be open when the test is running, if there are other tests running
43574361 // in parallel.
43584362
4363+ // Make sure we start with an empty list of connectors. This cleans up connectors
4364+ // that other tests might have created, but not cleaned up.
4365+ connectors := spannerDriver .connectors
4366+ for _ , connector := range connectors {
4367+ _ = connector .Close ()
4368+ }
4369+
43594370 db , _ , teardown := setupTestDBConnection (t )
43604371 defer teardown ()
43614372
@@ -4365,9 +4376,8 @@ func TestCannotReuseClosedConnector(t *testing.T) {
43654376 t .Fatalf ("failed to get a connection: %v" , err )
43664377 }
43674378 _ = conn .Close ()
4368- connectors := db .Driver ().(* Driver ).connectors
43694379 if g , w := len (connectors ), 1 ; g != w {
4370- t .Fatal ("underlying connector has not been created" )
4380+ t .Fatalf ("underlying connector count mismatch \n Got: %v \n Want: %v" , g , w )
43714381 }
43724382 var connector * connector
43734383 for _ , v := range connectors {
0 commit comments