Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
54486: sql: deflake TestTemporarySchemaDropDatabase r=arulajmani a=otan

The job looks like it can race with the check, so hide this behind a
SucceedsSoon.

Resolves cockroachdb#54467.

Release note: None

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
  • Loading branch information
craig[bot] and otan committed Sep 17, 2020
2 parents cb3ecbc + 1e4b20a commit c37cff8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pkg/sql/temporary_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
}

Expand Down

0 comments on commit c37cff8

Please sign in to comment.