Skip to content

Commit

Permalink
serverccl: remove remaining uses of TODOTestTenantDisabled
Browse files Browse the repository at this point in the history
This also simplifies some tests so they don't need to start an entire
cluster.

The remaining mentions of `TODOTestTenantDisabled` are handled in
issues  cockroachdb#106897, cockroachdb#106903 and cockroachdb#106901.

Release note: None
  • Loading branch information
knz committed Jul 17, 2023
1 parent fd6f283 commit c701779
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 164 deletions.
9 changes: 4 additions & 5 deletions pkg/ccl/serverccl/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestListTenants(t *testing.T) {

ctx := context.Background()
s, _, _ := serverutils.StartServer(t, base.TestServerArgs{
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
})
defer s.Stopper().Stop(ctx)

Expand Down Expand Up @@ -206,14 +206,13 @@ func TestListTenants(t *testing.T) {

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

ctx := context.Background()
s, _, _ := serverutils.StartServer(t, base.TestServerArgs{DefaultTestTenant: base.TODOTestTenantDisabled})
s, db, _ := serverutils.StartServer(t, base.TestServerArgs{})
defer s.Stopper().Stop(ctx)

st, db := serverutils.StartTenant(t, s, base.TestTenantArgs{
TenantID: serverutils.TestTenantID(),
})
st := s.TenantOrServer()
_, err := db.Exec("CREATE TABLE test (id int)")
require.NoError(t, err)
_, err = db.Exec("INSERT INTO test VALUES (1)")
Expand Down
3 changes: 3 additions & 0 deletions pkg/ccl/serverccl/api_v2_tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ import (
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/server"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/datadriven"
"github.com/stretchr/testify/require"
)

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

server.SQLAPIClock = timeutil.NewManualTime(timeutil.FromUnixMicros(0))
defer func() {
server.SQLAPIClock = timeutil.DefaultTimeSource{}
Expand Down
24 changes: 14 additions & 10 deletions pkg/ccl/serverccl/server_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,20 @@ func TestSharedProcessTenantNodeLocalAccess(t *testing.T) {
}()

tc := serverutils.StartNewTestCluster(t, nodeCount, base.TestClusterArgs{
ServerArgs: base.TestServerArgs{DefaultTestTenant: base.TODOTestTenantDisabled},
ServerArgs: base.TestServerArgs{
DefaultTestTenant: base.TestControlsTenantsExplicitly,
},
ServerArgsPerNode: map[int]base.TestServerArgs{
0: {
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
ExternalIODir: dirs[0],
},
1: {
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
ExternalIODir: dirs[1],
},
2: {
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
ExternalIODir: dirs[2],
},
},
Expand Down Expand Up @@ -135,7 +137,7 @@ func TestSharedProcessServerInheritsTempStorageLimit(t *testing.T) {
s, _, _ := serverutils.StartServer(t, base.TestServerArgs{
Settings: st,
TempStorageConfig: base.DefaultTestTempStorageConfigWithSize(st, specialSize),
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
})
defer s.Stopper().Stop(ctx)

Expand All @@ -158,7 +160,7 @@ func TestServerControllerHTTP(t *testing.T) {
ctx := context.Background()

s, db, _ := serverutils.StartServer(t, base.TestServerArgs{
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
})
defer s.Stopper().Stop(ctx)

Expand Down Expand Up @@ -334,7 +336,9 @@ func TestServerControllerDefaultHTTPTenant(t *testing.T) {

ctx := context.Background()

s, _, _ := serverutils.StartServer(t, base.TestServerArgs{DefaultTestTenant: base.TODOTestTenantDisabled})
s, _, _ := serverutils.StartServer(t, base.TestServerArgs{
DefaultTestTenant: base.TestControlsTenantsExplicitly,
})
defer s.Stopper().Stop(ctx)

_, sql, err := s.StartSharedProcessTenant(ctx, base.TestSharedProcessTenantArgs{
Expand Down Expand Up @@ -420,7 +424,7 @@ func TestServerControllerMultiNodeTenantStartup(t *testing.T) {
Knobs: base.TestingKnobs{
JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals(),
},
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
}})
defer func() {
t.Logf("stopping test cluster")
Expand Down Expand Up @@ -472,7 +476,7 @@ func TestServerStartStop(t *testing.T) {
ctx := context.Background()

s, db, _ := serverutils.StartServer(t, base.TestServerArgs{
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
})
defer s.Stopper().Stop(ctx)

Expand Down Expand Up @@ -635,7 +639,7 @@ func TestServiceShutdownUsesGracefulDrain(t *testing.T) {
ctx := context.Background()

s, db, _ := serverutils.StartServer(t, base.TestServerArgs{
DefaultTestTenant: base.TODOTestTenantDisabled,
DefaultTestTenant: base.TestControlsTenantsExplicitly,
})
defer s.Stopper().Stop(ctx)

Expand Down
Loading

0 comments on commit c701779

Please sign in to comment.