Skip to content

Commit 258b166

Browse files
craig[bot]yuzefovich
andcommitted
Merge #156144
156144: gcjob_test: remove package level skip of test tenant randomization r=yuzefovich a=yuzefovich Epic: CRDB-48945 Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
2 parents c3b2059 + 8271c9e commit 258b166

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

pkg/sql/gcjob_test/gc_job_test.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ func doTestSchemaChangeGCJob(t *testing.T, dropItem DropItem, ttlTime TTLTime) {
9999
// call to stop the TestServer. Otherwise, the quiesce step of shutting down
100100
// can hang forever waiting for the GC job.
101101
defer close(blockGC)
102-
sqlDB := sqlutils.MakeSQLRunner(db)
103102

104-
sqlDB.Exec(t, `SET CLUSTER SETTING sql.gc_job.wait_for_gc.interval = '1s';`)
103+
sysDB := sqlutils.MakeSQLRunner(srv.SystemLayer().SQLConn(t))
104+
sysDB.Exec(t, `SET CLUSTER SETTING sql.gc_job.wait_for_gc.interval = '1s';`)
105+
106+
sqlDB := sqlutils.MakeSQLRunner(db)
105107
// Refresh protected timestamp cache immediately to make MVCC GC queue to
106108
// process GC immediately.
107109
sqlDB.Exec(t, `SET CLUSTER SETTING kv.protectedts.poll_interval = '1s';`)
@@ -194,10 +196,10 @@ func doTestSchemaChangeGCJob(t *testing.T, dropItem DropItem, ttlTime TTLTime) {
194196

195197
if err := kvDB.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {
196198
b := txn.NewBatch()
197-
descKey := catalogkeys.MakeDescMetadataKey(keys.SystemSQLCodec, myTableID)
199+
descKey := catalogkeys.MakeDescMetadataKey(s.Codec(), myTableID)
198200
descDesc := myTableDesc.DescriptorProto()
199201
b.Put(descKey, descDesc)
200-
descKey2 := catalogkeys.MakeDescMetadataKey(keys.SystemSQLCodec, myOtherTableID)
202+
descKey2 := catalogkeys.MakeDescMetadataKey(s.Codec(), myOtherTableID)
201203
descDesc2 := myOtherTableDesc.DescriptorProto()
202204
b.Put(descKey2, descDesc2)
203205
return txn.Run(ctx, b)
@@ -353,7 +355,7 @@ WHERE job_id = %s`, jobID)).Scan(&state, &statusMessage, &jobErr)
353355
})
354356
}
355357

356-
// TestGCTenant is lightweight test that tests the branching logic in Resume
358+
// TestGCResumer is lightweight test that tests the branching logic in Resume
357359
// depending on if the job is GC for tenant or tables/indexes.
358360
func TestGCResumer(t *testing.T) {
359361
defer leaktest.AfterTest(t)()
@@ -362,7 +364,12 @@ func TestGCResumer(t *testing.T) {
362364
defer gcjob.SetSmallMaxGCIntervalForTest()()
363365

364366
ctx := context.Background()
365-
args := base.TestServerArgs{Knobs: base.TestingKnobs{JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals()}}
367+
args := base.TestServerArgs{
368+
Knobs: base.TestingKnobs{
369+
JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals(),
370+
},
371+
DefaultTestTenant: base.TestIsSpecificToStorageLayerAndNeedsASystemTenant,
372+
}
366373
srv, sqlDB, _ := serverutils.StartServer(t, args)
367374
execCfg := srv.ExecutorConfig().(sql.ExecutorConfig)
368375
jobRegistry := execCfg.JobRegistry
@@ -460,7 +467,9 @@ func TestGCTenant(t *testing.T) {
460467
defer jobs.ResetConstructors()()
461468

462469
ctx := context.Background()
463-
srv, _, kvDB := serverutils.StartServer(t, base.TestServerArgs{})
470+
srv, _, kvDB := serverutils.StartServer(t, base.TestServerArgs{
471+
DefaultTestTenant: base.TestIsSpecificToStorageLayerAndNeedsASystemTenant,
472+
})
464473
execCfg := srv.ExecutorConfig().(sql.ExecutorConfig)
465474
defer srv.Stopper().Stop(ctx)
466475

pkg/sql/gcjob_test/main_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"os"
1010
"testing"
1111

12-
"github.com/cockroachdb/cockroach/pkg/base"
1312
"github.com/cockroachdb/cockroach/pkg/security/securityassets"
1413
"github.com/cockroachdb/cockroach/pkg/security/securitytest"
1514
"github.com/cockroachdb/cockroach/pkg/server"
@@ -22,9 +21,5 @@ func TestMain(m *testing.M) {
2221
randutil.SeedForTests()
2322
serverutils.InitTestServerFactory(server.TestServerFactory)
2423

25-
defer serverutils.TestingSetDefaultTenantSelectionOverride(
26-
base.TestIsForStuffThatShouldWorkWithSecondaryTenantsButDoesntYet(76378),
27-
)()
28-
2924
os.Exit(m.Run())
3025
}

0 commit comments

Comments
 (0)