Skip to content

Commit 1ffabca

Browse files
Flaky test fix TestCanGetKeyspaces (#16214)
Signed-off-by: Manan Gupta <manan@planetscale.com>
1 parent 231ba6b commit 1ffabca

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

go/cmd/vttestserver/cli/main_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,6 @@ func TestCanGetKeyspaces(t *testing.T) {
238238
conf := config
239239
defer resetConfig(conf)
240240

241-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
242-
defer cancel()
243-
244241
clusterInstance, err := startCluster()
245242
require.NoError(t, err)
246243
defer clusterInstance.TearDown()
@@ -251,16 +248,15 @@ func TestCanGetKeyspaces(t *testing.T) {
251248
}
252249
}()
253250

251+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
252+
defer cancel()
254253
assertGetKeyspaces(ctx, t, clusterInstance)
255254
}
256255

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

261-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
262-
defer cancel()
263-
264260
// Start a single consul in the background.
265261
cmd, serverAddr := startConsul(t)
266262
defer func() {
@@ -279,6 +275,8 @@ func TestExternalTopoServerConsul(t *testing.T) {
279275
require.NoError(t, err)
280276
defer cluster.TearDown()
281277

278+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
279+
defer cancel()
282280
assertGetKeyspaces(ctx, t, cluster)
283281
}
284282

0 commit comments

Comments
 (0)