Skip to content

Commit

Permalink
sql: TestRandomSyntaxFunctions use resettable timeouts
Browse files Browse the repository at this point in the history
Previously, TestRandomSyntaxFunctions could flake since
some operations could take a long time. A resettable timeout
makes things more dynamic, and allows timeouts to be extended
while other connections make progress for a limited time, which
can help with certain builtins that are schema changes (i.e. they
will wait on other connections).

Fixes: cockroachdb#99182

Release note: None
  • Loading branch information
fqazi committed Jul 20, 2023
1 parent 43d5804 commit b3765bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/sql/tests/rsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ func TestRandomSyntaxFunctions(t *testing.T) {
continue
case "crdb_internal.reset_sql_stats",
"crdb_internal.check_consistency",
"crdb_internal.request_statement_bundle":
"crdb_internal.request_statement_bundle",
"crdb_internal.reset_activity_tables":
// Skipped due to long execution time.
continue
}
Expand Down Expand Up @@ -414,7 +415,11 @@ func TestRandomSyntaxFunctions(t *testing.T) {
limit = " LIMIT 100"
}
s := fmt.Sprintf("SELECT %s(%s) %s", nb.name, strings.Join(args, ", "), limit)
return db.exec(t, ctx, s)
// Use a re-settable timeout since in concurrent scenario some operations may
// involve schema changes like truncates. In general this should make
// this test more resilient as the timeouts are reset as long progress
// is made on *some* connection.
return db.execWithResettableTimeout(t, ctx, s, *flagRSGExecTimeout, *flagRSGGoRoutines)
})
}

Expand Down

0 comments on commit b3765bb

Please sign in to comment.