Skip to content

Commit 657455e

Browse files
committed
sql: TestRandomSyntaxFunctions use resettable timeouts
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
1 parent e0235d0 commit 657455e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/sql/tests/rsg_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ func TestRandomSyntaxFunctions(t *testing.T) {
352352
continue
353353
case "crdb_internal.reset_sql_stats",
354354
"crdb_internal.check_consistency",
355-
"crdb_internal.request_statement_bundle":
355+
"crdb_internal.request_statement_bundle",
356+
"crdb_internal.reset_activity_tables":
356357
// Skipped due to long execution time.
357358
continue
358359
}
@@ -414,7 +415,11 @@ func TestRandomSyntaxFunctions(t *testing.T) {
414415
limit = " LIMIT 100"
415416
}
416417
s := fmt.Sprintf("SELECT %s(%s) %s", nb.name, strings.Join(args, ", "), limit)
417-
return db.exec(t, ctx, s)
418+
// Use a re-settable timeout since in concurrent scenario some operations may
419+
// involve schema changes like truncates. In general this should make
420+
// this test more resilient as the timeouts are reset as long progress
421+
// is made on *some* connection.
422+
return db.execWithResettableTimeout(t, ctx, s, *flagRSGExecTimeout, *flagRSGGoRoutines)
418423
})
419424
}
420425

0 commit comments

Comments
 (0)