From 4297acfa89de00664b827e277bd3dd27db7ce767 Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Mon, 16 Sep 2019 10:54:57 -0400 Subject: [PATCH] backupccl: fix test to actually use SucceedsSoon I saw this test fail because `sqldb.Exec` will call `t.Error()` if the `ALTER TABLE` fails. The `SucceedsSoon` was there for a good reason but was not doing anything. Release Justification: Fix for a flakey test. Release note: None --- pkg/ccl/backupccl/backup_test.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pkg/ccl/backupccl/backup_test.go b/pkg/ccl/backupccl/backup_test.go index a981ccb22319..a66d87f669eb 100644 --- a/pkg/ccl/backupccl/backup_test.go +++ b/pkg/ccl/backupccl/backup_test.go @@ -243,19 +243,16 @@ func TestBackupRestorePartitioned(t *testing.T) { // made in backupRestoreTestSetup.) These are wrapped with SucceedsSoon() // because EXPERIMENTAL_RELOCATE can fail if there are other replication // changes happening. - testutils.SucceedsSoon(t, func() error { - sqlDB.Exec(t, `ALTER TABLE data.bank EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 0)`) - return nil - }) - testutils.SucceedsSoon(t, func() error { - sqlDB.Exec(t, `ALTER TABLE data.bank EXPERIMENTAL_RELOCATE VALUES (ARRAY[2], 100)`) - return nil - }) - testutils.SucceedsSoon(t, func() error { - sqlDB.Exec(t, `ALTER TABLE data.bank EXPERIMENTAL_RELOCATE VALUES (ARRAY[3], 200)`) - return nil - }) - + for _, stmt := range []string{ + `ALTER TABLE data.bank EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 0)`, + `ALTER TABLE data.bank EXPERIMENTAL_RELOCATE VALUES (ARRAY[2], 100)`, + `ALTER TABLE data.bank EXPERIMENTAL_RELOCATE VALUES (ARRAY[3], 200)`, + } { + testutils.SucceedsSoon(t, func() error { + _, err := sqlDB.DB.ExecContext(ctx, stmt) + return err + }) + } const localFoo1 = localFoo + "/1" const localFoo2 = localFoo + "/2" const localFoo3 = localFoo + "/3"