Skip to content

Commit

Permalink
Flaky test fix TestCanGetKeyspaces (#16214)
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>
  • Loading branch information
GuptaManan100 authored Jun 18, 2024
1 parent 231ba6b commit 1ffabca
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions go/cmd/vttestserver/cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ func TestCanGetKeyspaces(t *testing.T) {
conf := config
defer resetConfig(conf)

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

clusterInstance, err := startCluster()
require.NoError(t, err)
defer clusterInstance.TearDown()
Expand All @@ -251,16 +248,15 @@ func TestCanGetKeyspaces(t *testing.T) {
}
}()

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
assertGetKeyspaces(ctx, t, clusterInstance)
}

func TestExternalTopoServerConsul(t *testing.T) {
conf := config
defer resetConfig(conf)

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

// Start a single consul in the background.
cmd, serverAddr := startConsul(t)
defer func() {
Expand All @@ -279,6 +275,8 @@ func TestExternalTopoServerConsul(t *testing.T) {
require.NoError(t, err)
defer cluster.TearDown()

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
assertGetKeyspaces(ctx, t, cluster)
}

Expand Down

0 comments on commit 1ffabca

Please sign in to comment.