Skip to content

Commit 4dbf49e

Browse files
committed
backup: remove TODOTestTenantDisabled for tests
This change is part of our effort to eliminate the remaining usages of `TODOTestTenantDisabled` from tests across various features. It removes its occurrence in the backup tests. Informs: cockroachdb#138912 Epic: CRDB-38970 Release note: None
1 parent 89d0fdd commit 4dbf49e

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

pkg/backup/backup_test.go

+9-29
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,7 @@ func TestBackupRestorePartitioned(t *testing.T) {
289289

290290
const numAccounts = 1000
291291

292-
// Disabled to run within tenant as certain MR features are not available to tenants.
293292
args := base.TestClusterArgs{
294-
ServerArgs: base.TestServerArgs{
295-
DefaultTestTenant: base.TODOTestTenantDisabled,
296-
},
297293
ServerArgsPerNode: map[int]base.TestServerArgs{
298294
0: {
299295
Locality: roachpb.Locality{Tiers: []roachpb.Tier{
@@ -452,9 +448,7 @@ func TestBackupRestoreExecLocality(t *testing.T) {
452448

453449
// Disabled to run within tenant as certain MR features are not available to tenants.
454450
args := base.TestClusterArgs{
455-
ServerArgs: base.TestServerArgs{
456-
DefaultTestTenant: base.TODOTestTenantDisabled,
457-
},
451+
ServerArgs: base.TestServerArgs{},
458452
ServerArgsPerNode: map[int]base.TestServerArgs{
459453
0: {
460454
ExternalIODir: "/west0",
@@ -585,14 +579,9 @@ func TestBackupRestoreAppend(t *testing.T) {
585579

586580
const numAccounts = 400
587581
ctx := context.Background()
588-
tc, sqlDB, tmpDir, cleanupFn := backupRestoreTestSetupWithParams(t, multiNode, numAccounts, InitManualReplication, params)
582+
_, sqlDB, tmpDir, cleanupFn := backupRestoreTestSetupWithParams(t, multiNode, numAccounts, InitManualReplication, params)
589583
defer cleanupFn()
590584

591-
if !tc.ApplicationLayer(0).Codec().ForSystemTenant() {
592-
systemRunner := sqlutils.MakeSQLRunner(tc.SystemLayer(0).SQLConn(t))
593-
systemRunner.Exec(t, `ALTER TENANT [$1] GRANT CAPABILITY can_admin_relocate_range=true`, serverutils.TestTenantID().ToUint64())
594-
}
595-
596585
// Ensure that each node has at least one leaseholder. (These splits were
597586
// made in backupRestoreTestSetup.) These are wrapped with SucceedsSoon()
598587
// because EXPERIMENTAL_RELOCATE can fail if there are other replication
@@ -4027,7 +4016,7 @@ func TestNonLinearChain(t *testing.T) {
40274016
defer cleanup()
40284017

40294018
tc := testcluster.NewTestCluster(t, 1, base.TestClusterArgs{ServerArgs: base.TestServerArgs{
4030-
DefaultTestTenant: base.TODOTestTenantDisabled, ExternalIODir: dir, Knobs: base.TestingKnobs{
4019+
ExternalIODir: dir, Knobs: base.TestingKnobs{
40314020
JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals(),
40324021
},
40334022
}})
@@ -6416,8 +6405,6 @@ func TestProtectedTimestampsFailDueToLimits(t *testing.T) {
64166405
// The meta table is used to track limits.
64176406
UseMetaTable: true,
64186407
}
6419-
// Test fails within a tenant. Tracked with #76378.
6420-
params.ServerArgs.DefaultTestTenant = base.TODOTestTenantDisabled
64216408
tc := testcluster.StartTestCluster(t, 1, params)
64226409
defer tc.Stopper().Stop(ctx)
64236410
db := tc.ServerConn(0)
@@ -9191,11 +9178,6 @@ func TestGCDropIndexSpanExpansion(t *testing.T) {
91919178
ctx := context.Background()
91929179
tc := testcluster.StartTestCluster(t, 1, base.TestClusterArgs{ServerArgs: base.TestServerArgs{
91939180
ExternalIODir: baseDir,
9194-
// This test hangs when run within a tenant. It's likely that
9195-
// the cause of the hang is the fact that we're waiting on the GC to
9196-
// complete, and we don't have visibility into the GC completing from
9197-
// the tenant. More investigation is required. Tracked with #76378.
9198-
DefaultTestTenant: base.TODOTestTenantDisabled,
91999181
Knobs: base.TestingKnobs{
92009182
GCJob: &sql.GCJobTestingKnobs{
92019183
RunBeforePerformGC: func(id jobspb.JobID) error {
@@ -9210,10 +9192,11 @@ func TestGCDropIndexSpanExpansion(t *testing.T) {
92109192
},
92119193
}})
92129194
defer tc.Stopper().Stop(ctx)
9195+
systemSQLRunner := sqlutils.MakeSQLRunner(tc.SystemLayer(0).SQLConn(t))
9196+
systemSQLRunner.Exec(t, `SET CLUSTER SETTING kv.closed_timestamp.target_duration = '100ms'`) // speeds up the test
9197+
92139198
conn := tc.Conns[0]
92149199
sqlRunner := sqlutils.MakeSQLRunner(conn)
9215-
sqlRunner.Exec(t, `SET CLUSTER SETTING kv.closed_timestamp.target_duration = '100ms'`) // speeds up the test
9216-
92179200
sqlRunner.Exec(t, `CREATE DATABASE test;`)
92189201
sqlRunner.Exec(t, ` USE test;`)
92199202
sqlRunner.Exec(t, `CREATE TABLE foo (id INT PRIMARY KEY, id2 INT, id3 INT, INDEX bar (id2), INDEX baz(id3));`)
@@ -9367,9 +9350,6 @@ func TestExcludeDataFromBackupAndRestore(t *testing.T) {
93679350
tc, sqlDB, _, cleanupFn := backupRestoreTestSetupWithParams(t, singleNode, 10,
93689351
InitManualReplication, base.TestClusterArgs{
93699352
ServerArgs: base.TestServerArgs{
9370-
// Disabled to run within tenants because the function that sets up the restoring cluster
9371-
// has not been configured yet to run within tenants.
9372-
DefaultTestTenant: base.TODOTestTenantDisabled,
93739353
Knobs: base.TestingKnobs{
93749354
JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals(), // speeds up test
93759355
SpanConfig: &spanconfig.TestingKnobs{
@@ -9391,8 +9371,9 @@ func TestExcludeDataFromBackupAndRestore(t *testing.T) {
93919371
})
93929372
defer cleanupFn()
93939373

9394-
sqlDB.Exec(t, `SET CLUSTER SETTING kv.rangefeed.enabled = true`)
9395-
sqlDB.Exec(t, `SET CLUSTER SETTING kv.closed_timestamp.target_duration = '100ms'`)
9374+
systemDB := sqlutils.MakeSQLRunner(tc.SystemLayer(0).SQLConn(t))
9375+
systemDB.Exec(t, `SET CLUSTER SETTING kv.rangefeed.enabled = true`)
9376+
systemDB.Exec(t, `SET CLUSTER SETTING kv.closed_timestamp.target_duration = '100ms'`)
93969377
conn := tc.Conns[0]
93979378

93989379
sqlDB.Exec(t, `CREATE TABLE data.foo (id INT, INDEX bar(id))`)
@@ -10990,7 +10971,6 @@ func TestBackupInLocality(t *testing.T) {
1099010971

1099110972
const numAccounts = 1000
1099210973

10993-
// Disabled to run within tenant as certain MR features are not available to tenants.
1099410974
args := base.TestClusterArgs{ServerArgsPerNode: map[int]base.TestServerArgs{
1099510975
0: {Locality: localityFromStr(t, "region=east,dc=1,az=1")},
1099610976
1: {Locality: localityFromStr(t, "region=east,dc=2,az=2")},

pkg/backup/backuptestutils/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ go_library(
1414
"//pkg/kv/kvserver",
1515
"//pkg/sql/sqlstats",
1616
"//pkg/testutils",
17+
"//pkg/testutils/serverutils",
1718
"//pkg/testutils/sqlutils",
1819
"//pkg/testutils/testcluster",
1920
"//pkg/util",

pkg/backup/backuptestutils/testutils.go

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
2020
"github.com/cockroachdb/cockroach/pkg/sql/sqlstats"
2121
"github.com/cockroachdb/cockroach/pkg/testutils"
22+
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
2223
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
2324
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
2425
"github.com/cockroachdb/cockroach/pkg/util"
@@ -161,6 +162,13 @@ func StartBackupRestoreTestCluster(
161162
}
162163
}
163164

165+
if tc.Server(0).StartedDefaultTestTenant() {
166+
systemDB := sqlutils.MakeSQLRunner(tc.SystemLayer(0).SQLConn(t))
167+
systemDB.Exec(t,
168+
`ALTER TENANT [$1] GRANT CAPABILITY can_admin_relocate_range=true`,
169+
serverutils.TestTenantID().ToUint64())
170+
}
171+
164172
return tc, sqlDB, opts.dataDir, func() {
165173
if !opts.skipInvalidDescriptorCheck {
166174
CheckForInvalidDescriptors(t, tc.Conns[0])

0 commit comments

Comments
 (0)