Skip to content

Commit eb9a07c

Browse files
committed
Fixed ordered of execution
1 parent a218a39 commit eb9a07c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/bigtable/bigtable_integration_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,27 @@ func TestBigtableToolEndpoints(t *testing.T) {
6868
uniqueID := strings.ReplaceAll(uuid.New().String(), "-", "")
6969
t.Logf("Starting Bigtable test with uniqueID: %s", uniqueID)
7070

71-
ctx, cancel := context.WithTimeout(context.Background(), 7*time.Minute)
72-
defer cancel()
73-
7471
var args []string
7572

7673
// Initialize AdminClient to create or delete tables
77-
adminClient, err := bigtable.NewAdminClient(ctx, sourceConfig["project"].(string), sourceConfig["instance"].(string))
74+
adminClient, err := bigtable.NewAdminClient(context.Background(), sourceConfig["project"].(string), sourceConfig["instance"].(string))
7875
if err != nil {
7976
t.Fatalf("Failed to create AdminClient: %v", err)
8077
}
81-
defer adminClient.Close()
82-
83-
// This will purge every table containing the uniqueID.
78+
79+
t.Cleanup(func() {
80+
adminClient.Close()
81+
})
82+
8483
t.Cleanup(func() {
8584
t.Logf("Running global cleanup for uniqueID: %s", uniqueID)
8685
tests.CleanupBigtableTables(t, context.Background(), adminClient, uniqueID)
8786
})
8887

88+
89+
ctx, cancel := context.WithTimeout(context.Background(), 7*time.Minute)
90+
defer cancel()
91+
8992
tableName := "param_table" + uniqueID
9093
tableNameAuth := "auth_table_" + uniqueID
9194
tableNameTemplateParam := "tmpl_param_table_" + uniqueID

0 commit comments

Comments
 (0)