@@ -1540,7 +1540,8 @@ func TestIntegration_TableDeletionProtection(t *testing.T) {
15401540 if testEnv .Config ().UseProd {
15411541 timeout = 5 * time .Minute
15421542 }
1543- ctx , _ := context .WithTimeout (context .Background (), timeout )
1543+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
1544+ defer cancel ()
15441545
15451546 adminClient , err := testEnv .NewAdminClient ()
15461547 if err != nil {
@@ -1618,7 +1619,8 @@ func TestIntegration_EnableChangeStream(t *testing.T) {
16181619 if testEnv .Config ().UseProd {
16191620 timeout = 5 * time .Minute
16201621 }
1621- ctx , _ := context .WithTimeout (context .Background (), timeout )
1622+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
1623+ defer cancel ()
16221624
16231625 adminClient , err := testEnv .NewAdminClient ()
16241626 if err != nil {
@@ -1702,7 +1704,8 @@ func TestIntegration_Admin(t *testing.T) {
17021704 if testEnv .Config ().UseProd {
17031705 timeout = 5 * time .Minute
17041706 }
1705- ctx , _ := context .WithTimeout (context .Background (), timeout )
1707+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
1708+ defer cancel ()
17061709
17071710 adminClient , err := testEnv .NewAdminClient ()
17081711 if err != nil {
@@ -1894,7 +1897,8 @@ func TestIntegration_TableIam(t *testing.T) {
18941897 }
18951898
18961899 timeout := 5 * time .Minute
1897- ctx , _ := context .WithTimeout (context .Background (), timeout )
1900+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
1901+ defer cancel ()
18981902
18991903 adminClient , err := testEnv .NewAdminClient ()
19001904 if err != nil {
@@ -1932,7 +1936,8 @@ func TestIntegration_BackupIAM(t *testing.T) {
19321936 t .Skip ("emulator doesn't support IAM Policy creation" )
19331937 }
19341938 timeout := 5 * time .Minute
1935- ctx , _ := context .WithTimeout (context .Background (), timeout )
1939+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
1940+ defer cancel ()
19361941
19371942 adminClient , err := testEnv .NewAdminClient ()
19381943 if err != nil {
@@ -2006,7 +2011,8 @@ func TestIntegration_AdminCreateInstance(t *testing.T) {
20062011 }
20072012
20082013 timeout := 7 * time .Minute
2009- ctx , _ := context .WithTimeout (context .Background (), timeout )
2014+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
2015+ defer cancel ()
20102016
20112017 iAdminClient , err := testEnv .NewInstanceAdminClient ()
20122018 if err != nil {
@@ -2291,7 +2297,9 @@ func TestIntegration_AdminUpdateInstanceLabels(t *testing.T) {
22912297
22922298 // Create an instance admin client
22932299 timeout := 7 * time .Minute
2294- ctx , _ := context .WithTimeout (context .Background (), timeout )
2300+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
2301+ defer cancel ()
2302+
22952303 iAdminClient , err := testEnv .NewInstanceAdminClient ()
22962304 if err != nil {
22972305 t .Fatalf ("NewInstanceAdminClient: %v" , err )
@@ -2387,7 +2395,8 @@ func TestIntegration_AdminUpdateInstanceAndSyncClusters(t *testing.T) {
23872395 }
23882396
23892397 timeout := 5 * time .Minute
2390- ctx , _ := context .WithTimeout (context .Background (), timeout )
2398+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
2399+ defer cancel ()
23912400
23922401 iAdminClient , err := testEnv .NewInstanceAdminClient ()
23932402 if err != nil {
@@ -2557,7 +2566,8 @@ func TestIntegration_Autoscaling(t *testing.T) {
25572566 }
25582567
25592568 timeout := 5 * time .Minute
2560- ctx , _ := context .WithTimeout (context .Background (), timeout )
2569+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
2570+ defer cancel ()
25612571
25622572 iAdminClient , err := testEnv .NewInstanceAdminClient ()
25632573 if err != nil {
@@ -2725,7 +2735,8 @@ func TestIntegration_Granularity(t *testing.T) {
27252735 if testEnv .Config ().UseProd {
27262736 timeout = 5 * time .Minute
27272737 }
2728- ctx , _ := context .WithTimeout (context .Background (), timeout )
2738+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
2739+ defer cancel ()
27292740
27302741 adminClient , err := testEnv .NewAdminClient ()
27312742 if err != nil {
@@ -3231,7 +3242,8 @@ func TestIntegration_AdminBackup(t *testing.T) {
32313242 }
32323243
32333244 timeout := 15 * time .Minute
3234- ctx , _ := context .WithTimeout (context .Background (), timeout )
3245+ ctx , cancel := context .WithTimeout (context .Background (), timeout )
3246+ defer cancel ()
32353247
32363248 adminClient , err := testEnv .NewAdminClient ()
32373249 if err != nil {
0 commit comments