Skip to content

Commit

Permalink
Fix potential race condition in the test
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Oct 30, 2024
1 parent 63bb89f commit 14928e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/cmd/vttablet/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func TestRunFailsToStartTabletManager(t *testing.T) {
"--restore_from_backup",
}

err := Main.Execute()
// Creating and canceling the context so that pending tasks in tm_init gets canceled before we close the topo server
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

err := Main.ExecuteContext(ctx)
require.ErrorContains(t, err, "you cannot enable --restore_from_backup without a my.cnf file")
}

0 comments on commit 14928e1

Please sign in to comment.