Skip to content

Commit

Permalink
Make the race detector happier
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Nov 29, 2024
1 parent e7fd715 commit f1c37fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion go/vt/mysqlctl/blackbox/backup_blackbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@ func TestExecuteBackupFailToWriteEachFileOnlyOnce(t *testing.T) {
"Completed backing up MANIFEST (attempt 2/2)",
}

// Sleep just long enough for everything to complete.
// It's not flaky, the race detector detects a race when there isn't,
// the machine is just too slow to propagate the ctxCancel() to all goroutines.
time.Sleep(2 * time.Second)
AssertLogs(t, expectedLogs, logger)

require.NoError(t, err)
Expand Down Expand Up @@ -693,6 +697,11 @@ func TestExecuteBackupFailToWriteFileTwice(t *testing.T) {
MysqlShutdownTimeout: MysqlShutdownTimeout,
}, bh)

// Sleep just long enough for everything to complete.
// It's not flaky, the race detector detects a race when there isn't,
// the machine is just too slow to propagate the ctxCancel() to all goroutines.
time.Sleep(2 * time.Second)

expectedLogs := []string{
"Backing up file: test1/0.ibd (attempt 1/2)",
"Backing up file: test1/0.ibd (attempt 2/2)",
Expand All @@ -706,7 +715,6 @@ func TestExecuteBackupFailToWriteFileTwice(t *testing.T) {
require.Equal(t, 2, ss.SourceCloseStats)
require.Equal(t, 2, ss.SourceOpenStats)
require.Equal(t, 2, ss.SourceReadStats)

require.ErrorContains(t, err, "failing first write")
require.Equal(t, mysqlctl.BackupUnusable, backupResult)
}
Expand Down

0 comments on commit f1c37fa

Please sign in to comment.