Skip to content

Commit 8f9c20f

Browse files
committed
tests: improve random syntax tests a bit
I just looked into a timeout and noticed that with the default test tenant we had many goroutines blocked on rate limiting. Given that our random syntax tests slam the server with huge load, I think it makes sense to disable the rate limiting for this test family. Release note: None
1 parent e6ae789 commit 8f9c20f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/sql/tests/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ go_test(
8787
"//pkg/kv/kvpb",
8888
"//pkg/kv/kvserver",
8989
"//pkg/kv/kvserver/concurrency",
90+
"//pkg/multitenant/tenantcapabilitiespb",
9091
"//pkg/roachpb",
9192
"//pkg/rpc/nodedialer",
9293
"//pkg/security/securityassets",

pkg/sql/tests/rsg_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/cockroachdb/cockroach/pkg/ccl"
2323
"github.com/cockroachdb/cockroach/pkg/internal/rsg"
2424
"github.com/cockroachdb/cockroach/pkg/internal/sqlsmith"
25+
"github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilitiespb"
2526
"github.com/cockroachdb/cockroach/pkg/sql"
2627
"github.com/cockroachdb/cockroach/pkg/sql/parser"
2728
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
@@ -897,6 +898,17 @@ func testRandomSyntax(
897898
}
898899
srv, rawDB, _ := serverutils.StartServer(t, params)
899900
defer srv.Stopper().Stop(ctx)
901+
if srv.StartedDefaultTestTenant() {
902+
// If we started a test tenant, then disable rate limiting for it (we're
903+
// going to be slamming the server with many queries, and we don't want
904+
// for them to be artificially delayed).
905+
tenID := serverutils.TestTenantID()
906+
_, err := srv.SystemLayer().SQLConn(t).Exec(
907+
"ALTER TENANT [$1] GRANT CAPABILITY exempt_from_rate_limiting", tenID.ToUint64())
908+
require.NoError(t, err)
909+
expCaps := map[tenantcapabilitiespb.ID]string{tenantcapabilitiespb.ExemptFromRateLimiting: "true"}
910+
serverutils.WaitForTenantCapabilities(t, srv, tenID, expCaps, "exempt_from_rate_limiting")
911+
}
900912
db := &verifyFormatDB{db: rawDB}
901913
// If the test fails we can log the previous set of statements.
902914
defer func() {

0 commit comments

Comments
 (0)