Skip to content

Commit

Permalink
test(bigtable): Cancel context (#9273)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhshkh authored Jan 23, 2024
1 parent 3213b45 commit c0a7049
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions bigtable/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,8 @@ func TestIntegration_TableDeletionProtection(t *testing.T) {
if testEnv.Config().UseProd {
timeout = 5 * time.Minute
}
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down Expand Up @@ -1618,7 +1619,8 @@ func TestIntegration_EnableChangeStream(t *testing.T) {
if testEnv.Config().UseProd {
timeout = 5 * time.Minute
}
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down Expand Up @@ -1702,7 +1704,8 @@ func TestIntegration_Admin(t *testing.T) {
if testEnv.Config().UseProd {
timeout = 5 * time.Minute
}
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down Expand Up @@ -1894,7 +1897,8 @@ func TestIntegration_TableIam(t *testing.T) {
}

timeout := 5 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down Expand Up @@ -1932,7 +1936,8 @@ func TestIntegration_BackupIAM(t *testing.T) {
t.Skip("emulator doesn't support IAM Policy creation")
}
timeout := 5 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down Expand Up @@ -2006,7 +2011,8 @@ func TestIntegration_AdminCreateInstance(t *testing.T) {
}

timeout := 7 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

iAdminClient, err := testEnv.NewInstanceAdminClient()
if err != nil {
Expand Down Expand Up @@ -2291,7 +2297,9 @@ func TestIntegration_AdminUpdateInstanceLabels(t *testing.T) {

// Create an instance admin client
timeout := 7 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

iAdminClient, err := testEnv.NewInstanceAdminClient()
if err != nil {
t.Fatalf("NewInstanceAdminClient: %v", err)
Expand Down Expand Up @@ -2387,7 +2395,8 @@ func TestIntegration_AdminUpdateInstanceAndSyncClusters(t *testing.T) {
}

timeout := 5 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

iAdminClient, err := testEnv.NewInstanceAdminClient()
if err != nil {
Expand Down Expand Up @@ -2557,7 +2566,8 @@ func TestIntegration_Autoscaling(t *testing.T) {
}

timeout := 5 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

iAdminClient, err := testEnv.NewInstanceAdminClient()
if err != nil {
Expand Down Expand Up @@ -2725,7 +2735,8 @@ func TestIntegration_Granularity(t *testing.T) {
if testEnv.Config().UseProd {
timeout = 5 * time.Minute
}
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down Expand Up @@ -3231,7 +3242,8 @@ func TestIntegration_AdminBackup(t *testing.T) {
}

timeout := 15 * time.Minute
ctx, _ := context.WithTimeout(context.Background(), timeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

adminClient, err := testEnv.NewAdminClient()
if err != nil {
Expand Down

0 comments on commit c0a7049

Please sign in to comment.