From 3df280c650b90150d7d2bdb146bf248ae4aedda9 Mon Sep 17 00:00:00 2001 From: Faizan Qazi Date: Wed, 19 Jul 2023 16:22:36 -0400 Subject: [PATCH] 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: #99182 Release note: None --- pkg/sql/tests/rsg_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/sql/tests/rsg_test.go b/pkg/sql/tests/rsg_test.go index 1428f983417b..9259b7736cdf 100644 --- a/pkg/sql/tests/rsg_test.go +++ b/pkg/sql/tests/rsg_test.go @@ -354,7 +354,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 } @@ -416,7 +417,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) }) }