From d30fec42e5102bfc40c711ff9ad0a51cf34a0c31 Mon Sep 17 00:00:00 2001 From: Rebecca Taft Date: Fri, 21 Jan 2022 15:45:04 -0600 Subject: [PATCH] stats: attempt to deflake TestCreateStatsControlJob 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 --- pkg/sql/stats/create_stats_job_test.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/sql/stats/create_stats_job_test.go b/pkg/sql/stats/create_stats_job_test.go index 8602afe83988..0e1506a20377 100644 --- a/pkg/sql/stats/create_stats_job_test.go +++ b/pkg/sql/stats/create_stats_job_test.go @@ -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.