Skip to content

Commit

Permalink
sql: add multi-tenant specific test for transaction_contention_events
Browse files Browse the repository at this point in the history
part of #96353

Epic: None

Release note: None
  • Loading branch information
j82w authored and stevendanna committed Feb 23, 2023
1 parent 5b3b52b commit 9a21db9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pkg/sql/crdb_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,36 @@ func TestTxnContentionEventsTable(t *testing.T) {
defer tc.Stopper().Stop(ctx)
conn := tc.ServerConn(0)
sqlDB := sqlutils.MakeSQLRunner(tc.ServerConn(0))
testTxnContentionEventsTableHelper(t, ctx, conn, sqlDB)
}

func TestTxnContentionEventsTableMultiTenant(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

ctx := context.Background()
tc := testcluster.StartTestCluster(t, 1,
base.TestClusterArgs{
ServerArgs: base.TestServerArgs{
// Test is designed to run with explicit tenants. No need to
// implicitly create a tenant.
DisableDefaultTestTenant: true,
},
})
defer tc.Stopper().Stop(ctx)
_, tSQL := serverutils.StartTenant(t, tc.Server(0), base.TestTenantArgs{
TenantID: roachpb.MustMakeTenantID(10),
})

conn, err := tSQL.Conn(ctx)
require.NoError(t, err)
sqlDB := sqlutils.MakeSQLRunner(conn)
defer tSQL.Close()

testTxnContentionEventsTableHelper(t, ctx, tSQL, sqlDB)
}

func testTxnContentionEventsTableHelper(t *testing.T, ctx context.Context, conn *gosql.DB, sqlDB *sqlutils.SQLRunner) {
sqlDB.Exec(
t,
`SET CLUSTER SETTING sql.metrics.statement_details.plan_collection.enabled = false;`)
Expand Down

0 comments on commit 9a21db9

Please sign in to comment.