Skip to content

Commit

Permalink
make sure the entire backup ctx is canceled before inspecting the logs
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Dec 9, 2024
1 parent 25791d8 commit 24935b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/vt/mysqlctl/blackbox/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ func TestExecuteBackupFailToWriteEachFileOnlyOnce(t *testing.T) {
mysqld.ExpectedExecuteSuperQueryList = []string{"STOP REPLICA", "START REPLICA"}

logger := logutil.NewMemoryLogger()
ctx, cancel := context.WithCancel(ctx)
backupResult, err := be.ExecuteBackup(ctx, mysqlctl.BackupParams{
Logger: logger,
Mysqld: mysqld,
Expand All @@ -628,6 +629,7 @@ func TestExecuteBackupFailToWriteEachFileOnlyOnce(t *testing.T) {
Shard: shard,
MysqlShutdownTimeout: MysqlShutdownTimeout,
}, bh)
cancel()

expectedLogs := []string{
"Backing up file: test1/0.ibd (attempt 1/2)",
Expand Down Expand Up @@ -680,6 +682,7 @@ func TestExecuteBackupFailToWriteFileTwice(t *testing.T) {

logger := logutil.NewMemoryLogger()
fakeStats := backupstats.NewFakeStats()
ctx, cancel := context.WithCancel(ctx)
backupResult, err := be.ExecuteBackup(ctx, mysqlctl.BackupParams{
Logger: logger,
Mysqld: mysqld,
Expand All @@ -696,6 +699,7 @@ func TestExecuteBackupFailToWriteFileTwice(t *testing.T) {
Shard: shard,
MysqlShutdownTimeout: MysqlShutdownTimeout,
}, bh)
cancel()

// Sleep just long enough for everything to complete.
// It's not flaky, the race detector detects a race when there isn't,
Expand Down

0 comments on commit 24935b2

Please sign in to comment.