Skip to content

Commit ee028ba

Browse files
committed
spanconfigccl: fix tests under multitenancy
Release note: None
1 parent 51aa625 commit ee028ba

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

pkg/ccl/spanconfigccl/spanconfigsplitterccl/datadriven_test.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ func TestDataDriven(t *testing.T) {
6767
datadriven.Walk(t, datapathutils.TestDataPath(t), func(t *testing.T, path string) {
6868
tc := testcluster.StartTestCluster(t, 1, base.TestClusterArgs{
6969
ServerArgs: base.TestServerArgs{
70-
// Fails with nil pointer dereference. Tracked with #76378 and #106818.
71-
DefaultTestTenant: base.TestDoesNotWorkWithSecondaryTenantsButWeDontKnowWhyYet(106818),
70+
DefaultTestTenant: base.TestControlsTenantsExplicitly,
7271
Knobs: base.TestingKnobs{
7372
SpanConfig: scKnobs,
7473
},
@@ -79,15 +78,10 @@ func TestDataDriven(t *testing.T) {
7978
spanConfigTestCluster := spanconfigtestcluster.NewHandle(t, tc, scKnobs)
8079
defer spanConfigTestCluster.Cleanup()
8180

82-
var tenant *spanconfigtestcluster.Tenant
83-
if strings.Contains(path, "tenant") {
84-
tenantID := roachpb.MustMakeTenantID(10)
85-
tenant = spanConfigTestCluster.InitializeTenant(ctx, tenantID)
86-
spanConfigTestCluster.AllowSecondaryTenantToSetZoneConfigurations(t, tenantID)
87-
spanConfigTestCluster.EnsureTenantCanSetZoneConfigurationsOrFatal(t, tenant)
88-
} else {
89-
tenant = spanConfigTestCluster.InitializeTenant(ctx, roachpb.SystemTenantID)
90-
}
81+
tenantID := roachpb.MustMakeTenantID(10)
82+
tenant := spanConfigTestCluster.InitializeTenant(ctx, tenantID)
83+
spanConfigTestCluster.AllowSecondaryTenantToSetZoneConfigurations(t, tenantID)
84+
spanConfigTestCluster.EnsureTenantCanSetZoneConfigurationsOrFatal(t, tenant)
9185

9286
// TODO(irfansharif): Expose this through the test harness once we integrate
9387
// it into the schema changer.
@@ -119,7 +113,8 @@ func TestDataDriven(t *testing.T) {
119113
var dbName, tbName string
120114
d.ScanArgs(t, "database", &dbName)
121115
d.ScanArgs(t, "table", &tbName)
122-
objID = tenant.LookupTableByName(ctx, dbName, tbName).GetID()
116+
tbl := tenant.LookupTableByName(ctx, dbName, tbName)
117+
objID = tbl.GetID()
123118
default:
124119
d.Fatalf(t, "insufficient/improper args (%v) provided to split", d.CmdArgs)
125120
}

pkg/ccl/spanconfigccl/spanconfigsqlwatcherccl/sqlwatcher_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ func TestSQLWatcherMultiple(t *testing.T) {
287287

288288
tc := testcluster.StartTestCluster(t, 1, base.TestClusterArgs{
289289
ServerArgs: base.TestServerArgs{
290-
DefaultTestTenant: base.TestDoesNotWorkWithSecondaryTenantsButWeDontKnowWhyYet(106821),
291290
Knobs: base.TestingKnobs{
292291
SpanConfig: &spanconfig.TestingKnobs{
293292
ManagerDisableJobCreation: true, // disable the automatic job creation.
@@ -305,7 +304,7 @@ func TestSQLWatcherMultiple(t *testing.T) {
305304

306305
noopCheckpointDuration := 100 * time.Millisecond
307306
sqlWatcher := spanconfigsqlwatcher.New(
308-
ts.Codec(),
307+
ts.ApplicationLayer().Codec(),
309308
ts.ClusterSettings(),
310309
ts.RangeFeedFactory().(*rangefeed.Factory),
311310
1<<20, /* 1 MB, bufferMemLimit */

0 commit comments

Comments
 (0)