Skip to content

Commit

Permalink
Merge #75296
Browse files Browse the repository at this point in the history
75296: stats: attempt to deflake TestCreateStatsControlJob r=rytaft a=rytaft

This commit changes the `TestCreateStatsControlJob` from using
`retry.WithMaxAttempts` to using `testutils.SucceedsSoon`, since
`testutils.SucceedsSoon` waits longer before failing. Hopefully
this will be enough to fix the periodic flakes of the test.

Fixes #71648

Release note: None

Co-authored-by: Rebecca Taft <[email protected]>
  • Loading branch information
craig[bot] and rytaft committed Jan 22, 2022
2 parents 6aa6c72 + d30fec4 commit 41afb44
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/sql/stats/create_stats_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,11 @@ func TestCreateStatsControlJob(t *testing.T) {
sqlDB.CheckQueryResults(t,
`SELECT statistics_name, column_names, row_count FROM [SHOW STATISTICS FOR TABLE d.t]`,
[][]string{})
opts := retry.Options{
InitialBackoff: 1 * time.Millisecond,
MaxBackoff: time.Second,
Multiplier: 2,
}
if err := retry.WithMaxAttempts(context.Background(), opts, 10, func() error {

testutils.SucceedsSoon(t, func() error {
_, err := sqlDB.DB.ExecContext(context.Background(), `RESUME JOB $1`, jobID)
return err
}); err != nil {
t.Fatal(err)
}

})
jobutils.WaitForJob(t, sqlDB, jobID)

// Now the job should have succeeded in producing stats.
Expand Down

0 comments on commit 41afb44

Please sign in to comment.