From 1e4b20ac4fdd5ed53f10d193ef1d9ce57c1ac0b5 Mon Sep 17 00:00:00 2001 From: Oliver Tan Date: Wed, 16 Sep 2020 19:29:55 -0700 Subject: [PATCH] sql: deflake TestTemporarySchemaDropDatabase The job looks like it can race with the check, so hide this behind a SucceedsSoon. Resolves #54467. Release note: None --- pkg/sql/temporary_schema_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/sql/temporary_schema_test.go b/pkg/sql/temporary_schema_test.go index 1ad536c4e629..073a41495256 100644 --- a/pkg/sql/temporary_schema_test.go +++ b/pkg/sql/temporary_schema_test.go @@ -327,12 +327,17 @@ func TestTemporarySchemaDropDatabase(t *testing.T) { sqlDB := sqlutils.MakeSQLRunner(db) sqlDB.Exec(t, `DROP DATABASE drop_me CASCADE`) - var tempObjectCount int - sqlDB.QueryRow( - t, - `SELECT count(1) FROM system.namespace WHERE name LIKE 'pg_temp%' OR name IN ('t', 't2')`, - ).Scan(&tempObjectCount) - assert.Equal(t, 0, tempObjectCount) + testutils.SucceedsSoon(t, func() error { + var tempObjectCount int + sqlDB.QueryRow( + t, + `SELECT count(1) FROM system.namespace WHERE name LIKE 'pg_temp%' OR name IN ('t', 't2')`, + ).Scan(&tempObjectCount) + if tempObjectCount == 0 { + return nil + } + return errors.AssertionFailedf("expected count 0, got %d", tempObjectCount) + }) } }