From bd6ded95ac7f377d6d0150b8b59df0a2b7f7ae91 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 17 Jul 2023 17:47:53 -0700 Subject: [PATCH 1/4] server: clean up the comments a bit This mostly adds `serverutils.` prefix to the interface names which allows for easier navigation (at least in the GoLand). Release note: None --- pkg/server/testserver.go | 148 ++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index b4cf0dfac091..97328b25d310 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -338,7 +338,8 @@ type TestServer struct { params base.TestServerArgs // server is the embedded Cockroach server struct. *Server - // httpTestServer provides the HTTP APIs of TestTenantInterface. + // httpTestServer provides the HTTP APIs of the + // serverutils.TestTenantInterface. *httpTestServer // The test tenants associated with this server, and used for probabilistic // testing within tenants. Currently, there is only one test tenant created @@ -369,7 +370,7 @@ func (ts *TestServer) Stopper() *stop.Stopper { return ts.stopper } -// GossipI is part of TestServerInterface. +// GossipI is part of the serverutils.TestServerInterface. func (ts *TestServer) GossipI() interface{} { return ts.Gossip() } @@ -452,12 +453,12 @@ func (ts *TestServer) HeartbeatNodeLiveness() error { return err } -// SQLInstanceID is part of TestServerInterface. +// SQLInstanceID is part of the serverutils.TestServerInterface. func (ts *TestServer) SQLInstanceID() base.SQLInstanceID { return ts.sqlServer.sqlIDContainer.SQLInstanceID() } -// StatusServer is part of TestServerInterface. +// StatusServer is part of the serverutils.TestServerInterface. func (ts *TestServer) StatusServer() interface{} { return ts.status } @@ -678,37 +679,37 @@ type TestTenant struct { var _ serverutils.TestTenantInterface = &TestTenant{} -// AnnotateCtx is part of TestTenantInterface. +// AnnotateCtx is part of the serverutils.TestTenantInterface. func (t *TestTenant) AnnotateCtx(ctx context.Context) context.Context { return t.sql.AnnotateCtx(ctx) } -// SQLInstanceID is part of TestTenantInterface. +// SQLInstanceID is part of the serverutils.TestTenantInterface. func (t *TestTenant) SQLInstanceID() base.SQLInstanceID { return t.sql.SQLInstanceID() } -// SQLAddr is part of TestTenantInterface interface. +// SQLAddr is part of the serverutils.TestTenantInterface. func (t *TestTenant) SQLAddr() string { return t.Cfg.SQLAddr } -// HTTPAddr is part of TestTenantInterface interface. +// HTTPAddr is part of the serverutils.TestTenantInterface. func (t *TestTenant) HTTPAddr() string { return t.Cfg.HTTPAddr } -// RPCAddr is part of the TestTenantInterface interface. +// RPCAddr is part of the serverutils.TestTenantInterface. func (t *TestTenant) RPCAddr() string { return t.Cfg.Addr } -// DB is part of the TestTenantInterface. +// DB is part of the serverutils.TestTenantInterface. func (t *TestTenant) DB() *kv.DB { return t.sql.execCfg.DB } -// PGServer is part of TestTenantInterface. +// PGServer is part of the serverutils.TestTenantInterface. func (t *TestTenant) PGServer() interface{} { return t.sql.pgServer } @@ -722,67 +723,67 @@ func (ts *TestTenant) PGPreServer() interface{} { return nil } -// DiagnosticsReporter is part of TestTenantInterface. +// DiagnosticsReporter is part of the serverutils.TestTenantInterface. func (t *TestTenant) DiagnosticsReporter() interface{} { return t.sql.diagnosticsReporter } -// StatusServer is part of TestTenantInterface. +// StatusServer is part of the serverutils.TestTenantInterface. func (t *TestTenant) StatusServer() interface{} { return t.sql.execCfg.SQLStatusServer } -// TenantStatusServer is part of TestTenantInterface. +// TenantStatusServer is part of the serverutils.TestTenantInterface. func (t *TestTenant) TenantStatusServer() interface{} { return t.sql.execCfg.TenantStatusServer } -// SQLServer is part of TestTenantInterface. +// SQLServer is part of the serverutils.TestTenantInterface. func (t *TestTenant) SQLServer() interface{} { return t.sql.pgServer.SQLServer } -// DistSQLServer is part of TestTenantInterface. +// DistSQLServer is part of the serverutils.TestTenantInterface. func (t *TestTenant) DistSQLServer() interface{} { return t.sql.distSQLServer } -// DistSenderI is part of the TestTenantInterface. +// DistSenderI is part of the serverutils.TestTenantInterface. func (t *TestTenant) DistSenderI() interface{} { return t.sql.execCfg.DistSender } -// RPCContext is part of TestTenantInterface. +// RPCContext is part of the serverutils.TestTenantInterface. func (t *TestTenant) RPCContext() *rpc.Context { return t.sql.execCfg.RPCContext } -// JobRegistry is part of TestTenantInterface. +// JobRegistry is part of the serverutils.TestTenantInterface. func (t *TestTenant) JobRegistry() interface{} { return t.sql.jobRegistry } -// ExecutorConfig is part of TestTenantInterface. +// ExecutorConfig is part of the serverutils.TestTenantInterface. func (t *TestTenant) ExecutorConfig() interface{} { return *t.sql.execCfg } -// RangeFeedFactory is part of TestTenantInterface. +// RangeFeedFactory is part of the serverutils.TestTenantInterface. func (t *TestTenant) RangeFeedFactory() interface{} { return t.sql.execCfg.RangeFeedFactory } -// ClusterSettings is part of TestTenantInterface. +// ClusterSettings is part of the serverutils.TestTenantInterface. func (t *TestTenant) ClusterSettings() *cluster.Settings { return t.Cfg.Settings } -// Stopper is part of TestTenantInterface. +// Stopper is part of the serverutils.TestTenantInterface. func (t *TestTenant) Stopper() *stop.Stopper { return t.sql.stopper } -// Clock is part of TestTenantInterface. +// Clock is part of the serverutils.TestTenantInterface. func (t *TestTenant) Clock() *hlc.Clock { return t.sql.execCfg.Clock } @@ -794,37 +795,38 @@ func (t *TestTenant) AmbientCtx() log.AmbientContext { return t.Cfg.AmbientCtx } -// TestingKnobs is part TestTenantInterface. +// TestingKnobs is part of the serverutils.TestTenantInterface. func (t *TestTenant) TestingKnobs() *base.TestingKnobs { return &t.Cfg.TestingKnobs } -// SpanConfigKVAccessor is part TestTenantInterface. +// SpanConfigKVAccessor is part of the serverutils.TestTenantInterface. func (t *TestTenant) SpanConfigKVAccessor() interface{} { return t.sql.tenantConnect } -// SpanConfigReporter is part TestTenantInterface. +// SpanConfigReporter is part of the serverutils.TestTenantInterface. func (t *TestTenant) SpanConfigReporter() interface{} { return t.sql.tenantConnect } -// SpanConfigReconciler is part TestTenantInterface. +// SpanConfigReconciler is part of the serverutils.TestTenantInterface. func (t *TestTenant) SpanConfigReconciler() interface{} { return t.sql.spanconfigMgr.Reconciler } -// SpanConfigSQLTranslatorFactory is part TestTenantInterface. +// SpanConfigSQLTranslatorFactory is part of the +// serverutils.TestTenantInterface. func (t *TestTenant) SpanConfigSQLTranslatorFactory() interface{} { return t.sql.spanconfigSQLTranslatorFactory } -// SpanConfigSQLWatcher is part TestTenantInterface. +// SpanConfigSQLWatcher is part of the serverutils.TestTenantInterface. func (t *TestTenant) SpanConfigSQLWatcher() interface{} { return t.sql.spanconfigSQLWatcher } -// SystemConfigProvider is part TestTenantInterface. +// SystemConfigProvider is part of the serverutils.TestTenantInterface. func (t *TestTenant) SystemConfigProvider() config.SystemConfigProvider { return t.sql.systemConfigWatcher } @@ -834,32 +836,32 @@ func (t *TestTenant) DrainClients(ctx context.Context) error { return t.drain.drainClients(ctx, nil /* reporter */) } -// MustGetSQLCounter implements TestTenantInterface. +// MustGetSQLCounter implements serverutils.TestTenantInterface. func (t *TestTenant) MustGetSQLCounter(name string) int64 { return mustGetSQLCounterForRegistry(t.sql.metricsRegistry, name) } -// RangeDescIteratorFactory implements the TestTenantInterface. +// RangeDescIteratorFactory implements the serverutils.TestTenantInterface. func (t *TestTenant) RangeDescIteratorFactory() interface{} { return t.sql.execCfg.RangeDescIteratorFactory } -// Codec is part of the TestTenantInterface. +// Codec is part of the serverutils.TestTenantInterface. func (t *TestTenant) Codec() keys.SQLCodec { return t.sql.execCfg.Codec } -// Tracer is part of the TestTenantInterface. +// Tracer is part of the serverutils.TestTenantInterface. func (t *TestTenant) Tracer() *tracing.Tracer { return t.sql.ambientCtx.Tracer } -// SettingsWatcher is part of the TestTenantInterface. +// SettingsWatcher is part of the serverutils.TestTenantInterface. func (t *TestTenant) SettingsWatcher() interface{} { return t.sql.settingsWatcher } -// StartSharedProcessTenant is part of TestServerInterface. +// StartSharedProcessTenant is part of the serverutils.TestServerInterface. func (ts *TestServer) StartSharedProcessTenant( ctx context.Context, args base.TestSharedProcessTenantArgs, ) (serverutils.TestTenantInterface, *gosql.DB, error) { @@ -961,17 +963,17 @@ func (ts *TestServer) StartSharedProcessTenant( return testTenant, sqlDB, err } -// DisableStartTenant is part of TestServerInterface. +// DisableStartTenant is part of the serverutils.TestServerInterface. func (ts *TestServer) DisableStartTenant(reason error) { ts.disableStartTenantError = reason } -// MigrationServer is part of the TestTenantInterface. +// MigrationServer is part of the serverutils.TestTenantInterface. func (t *TestTenant) MigrationServer() interface{} { return t.sql.migrationServer } -// StartTenant is part of TestServerInterface. +// StartTenant is part of the serverutils.TestServerInterface. func (ts *TestServer) StartTenant( ctx context.Context, params base.TestTenantArgs, ) (serverutils.TestTenantInterface, error) { @@ -1255,7 +1257,7 @@ func (ts *TestServer) Stores() *kvserver.Stores { return ts.node.stores } -// GetStores is part of TestServerInterface. +// GetStores is part of the serverutils.TestServerInterface. func (ts *TestServer) GetStores() interface{} { return ts.node.stores } @@ -1265,7 +1267,7 @@ func (ts *TestServer) ClusterSettings() *cluster.Settings { return ts.Cfg.Settings } -// SettingsWatcher is part of the TestTenantInterface. +// SettingsWatcher is part of the serverutils.TestTenantInterface. func (ts *TestServer) SettingsWatcher() interface{} { return ts.sqlServer.settingsWatcher } @@ -1330,17 +1332,17 @@ func (ts *TestServer) Readiness(ctx context.Context) error { return ts.admin.checkReadinessForHealthCheck(ctx) } -// WriteSummaries implements TestServerInterface. +// WriteSummaries implements the serverutils.TestServerInterface. func (ts *TestServer) WriteSummaries() error { return ts.node.writeNodeStatus(context.TODO(), time.Hour, false) } -// UpdateChecker implements TestServerInterface. +// UpdateChecker implements the serverutils.TestServerInterface. func (ts *TestServer) UpdateChecker() interface{} { return ts.Server.updates } -// DiagnosticsReporter implements TestServerInterface. +// DiagnosticsReporter implements the serverutils.TestServerInterface. func (ts *TestServer) DiagnosticsReporter() interface{} { return ts.Server.sqlServer.diagnosticsReporter } @@ -1373,7 +1375,7 @@ func (ts *TestServer) MustGetSQLCounter(name string) int64 { return mustGetSQLCounterForRegistry(ts.registry, name) } -// MustGetSQLNetworkCounter implements TestServerInterface. +// MustGetSQLNetworkCounter implements the serverutils.TestServerInterface. func (ts *TestServer) MustGetSQLNetworkCounter(name string) int64 { var c int64 var found bool @@ -1405,17 +1407,17 @@ func (ts *TestServer) Locality() *roachpb.Locality { return &ts.cfg.Locality } -// LeaseManager is part of TestServerInterface. +// LeaseManager is part of the serverutils.TestServerInterface. func (ts *TestServer) LeaseManager() interface{} { return ts.sqlServer.leaseMgr } -// InternalExecutor is part of TestServerInterface. +// InternalExecutor is part of the serverutils.TestServerInterface. func (ts *TestServer) InternalExecutor() interface{} { return ts.sqlServer.internalExecutor } -// InternalDB is part of TestServerInterface. +// InternalDB is part of the serverutils.TestServerInterface. func (ts *TestServer) InternalDB() interface{} { return ts.sqlServer.internalDB } @@ -1436,22 +1438,22 @@ func (ts *TestServer) DistSender() *kvcoord.DistSender { return ts.DistSenderI().(*kvcoord.DistSender) } -// MigrationServer is part of TestServerInterface. +// MigrationServer is part of the serverutils.TestServerInterface. func (ts *TestServer) MigrationServer() interface{} { return ts.migrationServer } -// SpanConfigKVAccessor is part of TestServerInterface. +// SpanConfigKVAccessor is part of the serverutils.TestServerInterface. func (ts *TestServer) SpanConfigKVAccessor() interface{} { return ts.Server.node.spanConfigAccessor } -// SpanConfigReporter is part of TestServerInterface. +// SpanConfigReporter is part of the serverutils.TestServerInterface. func (ts *TestServer) SpanConfigReporter() interface{} { return ts.Server.node.spanConfigReporter } -// SpanConfigReconciler is part of TestServerInterface. +// SpanConfigReconciler is part of the serverutils.TestServerInterface. func (ts *TestServer) SpanConfigReconciler() interface{} { if ts.sqlServer.spanconfigMgr == nil { panic("uninitialized; see EnableSpanConfigs testing knob to use span configs") @@ -1459,7 +1461,7 @@ func (ts *TestServer) SpanConfigReconciler() interface{} { return ts.sqlServer.spanconfigMgr.Reconciler } -// SpanConfigSQLTranslatorFactory is part of TestServerInterface. +// SpanConfigSQLTranslatorFactory is part of the serverutils.TestServerInterface. func (ts *TestServer) SpanConfigSQLTranslatorFactory() interface{} { if ts.sqlServer.spanconfigSQLTranslatorFactory == nil { panic("uninitialized; see EnableSpanConfigs testing knob to use span configs") @@ -1467,7 +1469,7 @@ func (ts *TestServer) SpanConfigSQLTranslatorFactory() interface{} { return ts.sqlServer.spanconfigSQLTranslatorFactory } -// SpanConfigSQLWatcher is part of TestServerInterface. +// SpanConfigSQLWatcher is part of the serverutils.TestServerInterface. func (ts *TestServer) SpanConfigSQLWatcher() interface{} { if ts.sqlServer.spanconfigSQLWatcher == nil { panic("uninitialized; see EnableSpanConfigs testing knob to use span configs") @@ -1475,22 +1477,22 @@ func (ts *TestServer) SpanConfigSQLWatcher() interface{} { return ts.sqlServer.spanconfigSQLWatcher } -// SQLServer is part of TestTenantInterface. +// SQLServer is part of the serverutils.TestTenantInterface. func (ts *TestServer) SQLServer() interface{} { return ts.sqlServer.pgServer.SQLServer } -// DistSQLServer is part of TestTenantInterface. +// DistSQLServer is part of the serverutils.TestTenantInterface. func (ts *TestServer) DistSQLServer() interface{} { return ts.sqlServer.distSQLServer } -// SetDistSQLSpanResolver is part of TestServerInterface. +// SetDistSQLSpanResolver is part of the serverutils.TestServerInterface. func (s *Server) SetDistSQLSpanResolver(spanResolver interface{}) { s.sqlServer.execCfg.DistSQLPlanner.SetSpanResolver(spanResolver.(physicalplan.SpanResolver)) } -// GetFirstStoreID is part of TestServerInterface. +// GetFirstStoreID is part of the serverutils.TestServerInterface. func (ts *TestServer) GetFirstStoreID() roachpb.StoreID { firstStoreID := roachpb.StoreID(-1) err := ts.Stores().VisitStores(func(s *kvserver.Store) error { @@ -1700,17 +1702,17 @@ func (ts *TestServer) GetRangeLease( return l, ts.Clock().NowAsClockTimestamp(), nil } -// ExecutorConfig is part of the TestServerInterface. +// ExecutorConfig is part of the serverutils.TestTenantInterface. func (ts *TestServer) ExecutorConfig() interface{} { return *ts.sqlServer.execCfg } -// StartedDefaultTestTenant is part of the TestServerInterface. +// StartedDefaultTestTenant is part of the serverutils.TestServerInterface. func (ts *TestServer) StartedDefaultTestTenant() bool { return !ts.cfg.DisableDefaultTestTenant } -// TenantOrServer is part of the TestServerInterface. +// TenantOrServer is part of the serverutils.TestServerInterface. func (ts *TestServer) TenantOrServer() serverutils.TestTenantInterface { if ts.StartedDefaultTestTenant() { return ts.testTenants[0] @@ -1718,7 +1720,7 @@ func (ts *TestServer) TenantOrServer() serverutils.TestTenantInterface { return ts } -// TracerI is part of the TestServerInterface. +// TracerI is part of the serverutils.TestServerInterface. func (ts *TestServer) TracerI() interface{} { return ts.Tracer() } @@ -1728,7 +1730,7 @@ func (ts *TestServer) Tracer() *tracing.Tracer { return ts.node.storeCfg.AmbientCtx.Tracer } -// ForceTableGC is part of TestServerInterface. +// ForceTableGC is part of the serverutils.TestServerInterface. func (ts *TestServer) ForceTableGC( ctx context.Context, database, table string, timestamp hlc.Timestamp, ) error { @@ -1807,32 +1809,32 @@ func (ts *TestServer) MetricsRecorder() *status.MetricsRecorder { return ts.node.recorder } -// CollectionFactory is part of the TestServerInterface. +// CollectionFactory is part of the serverutils.TestServerInterface. func (ts *TestServer) CollectionFactory() interface{} { return ts.sqlServer.execCfg.CollectionFactory } -// SystemTableIDResolver is part of the TestServerInterface. +// SystemTableIDResolver is part of the serverutils.TestServerInterface. func (ts *TestServer) SystemTableIDResolver() interface{} { return ts.sqlServer.execCfg.SystemTableIDResolver } -// SpanConfigKVSubscriber is part of the TestServerInterface. +// SpanConfigKVSubscriber is part of the serverutils.TestServerInterface. func (ts *TestServer) SpanConfigKVSubscriber() interface{} { return ts.node.storeCfg.SpanConfigSubscriber } -// SystemConfigProvider is part of the TestServerInterface. +// SystemConfigProvider is part of the serverutils.TestTenantInterface. func (ts *TestServer) SystemConfigProvider() config.SystemConfigProvider { return ts.node.storeCfg.SystemConfigProvider } -// KVFlowController is part of the TestServerInterface. +// KVFlowController is part of the serverutils.TestServerInterface. func (ts *TestServer) KVFlowController() interface{} { return ts.node.storeCfg.KVFlowController } -// KVFlowHandles is part of the TestServerInterface. +// KVFlowHandles is part of the serverutils.TestServerInterface. func (ts *TestServer) KVFlowHandles() interface{} { return ts.node.storeCfg.KVFlowHandles } @@ -1841,12 +1843,12 @@ func (ts *TestServer) Codec() keys.SQLCodec { return ts.ExecutorConfig().(sql.ExecutorConfig).Codec } -// RangeDescIteratorFactory is part of the TestServerInterface. +// RangeDescIteratorFactory is part of the serverutils.TestServerInterface. func (ts *TestServer) RangeDescIteratorFactory() interface{} { return ts.sqlServer.execCfg.RangeDescIteratorFactory } -// BinaryVersionOverride is part of the TestServerInterface. +// BinaryVersionOverride is part of the serverutils.TestServerInterface. func (ts *TestServer) BinaryVersionOverride() roachpb.Version { knobs := ts.TestingKnobs().Server if knobs == nil { @@ -1855,7 +1857,7 @@ func (ts *TestServer) BinaryVersionOverride() roachpb.Version { return knobs.(*TestingKnobs).BinaryVersionOverride } -// KvProber is part of the TestServerInterface. +// KvProber is part of the serverutils.TestServerInterface. func (ts *TestServer) KvProber() *kvprober.Prober { return ts.Server.kvProber } From 609230c7122fe5935a6faa3a900abe8975062ed2 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 17 Jul 2023 17:55:34 -0700 Subject: [PATCH 2/4] serverutils: move TracerI into TestTenantInterface Tracer method is already in TestTenantInterface. Release note: None --- pkg/server/testserver.go | 5 +++++ pkg/testutils/serverutils/test_server_shim.go | 3 --- pkg/testutils/serverutils/test_tenant_shim.go | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index 97328b25d310..402e50c53bec 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -856,6 +856,11 @@ func (t *TestTenant) Tracer() *tracing.Tracer { return t.sql.ambientCtx.Tracer } +// TracerI is part of the serverutils.TestTenantInterface. +func (t *TestTenant) TracerI() interface{} { + return t.Tracer +} + // SettingsWatcher is part of the serverutils.TestTenantInterface. func (t *TestTenant) SettingsWatcher() interface{} { return t.sql.settingsWatcher diff --git a/pkg/testutils/serverutils/test_server_shim.go b/pkg/testutils/serverutils/test_server_shim.go index b056abbe9922..ada35820dcea 100644 --- a/pkg/testutils/serverutils/test_server_shim.go +++ b/pkg/testutils/serverutils/test_server_shim.go @@ -149,9 +149,6 @@ type TestServerInterface interface { // insql.InternalDB as an interface{}. InternalDB() interface{} - // TracerI returns a *tracing.Tracer as an interface{}. - TracerI() interface{} - // GossipI returns the gossip used by the TestServer. // The real return type is *gossip.Gossip. GossipI() interface{} diff --git a/pkg/testutils/serverutils/test_tenant_shim.go b/pkg/testutils/serverutils/test_tenant_shim.go index be296a9cd47e..024fd30a77fa 100644 --- a/pkg/testutils/serverutils/test_tenant_shim.go +++ b/pkg/testutils/serverutils/test_tenant_shim.go @@ -218,6 +218,9 @@ type TestTenantInterface interface { // Tracer returns a reference to the tenant's Tracer. Tracer() *tracing.Tracer + // TracerI is the same as Tracer but returns an interface{}. + TracerI() interface{} + // MigrationServer returns the tenant's migration server, which is used in // upgrade testing. MigrationServer() interface{} From e0b83fdd0967a36fe16641d3e8b19c171cafddd6 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 17 Jul 2023 21:12:39 -0700 Subject: [PATCH 3/4] server: fix StartedDefaultTestTenant in an error case Previously, if `TestServer.Start` returned an error while the default test tenant wasn't disabled, we'd incorrectly consider that we had started the default test tenant. This, then, could lead to some problems (e.g. trying to access non-existing tenant which could lead to a crash). This is fixed by checking whether we have test tenants. Release note: None --- pkg/server/testserver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index 402e50c53bec..847de6444dcb 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -1714,7 +1714,7 @@ func (ts *TestServer) ExecutorConfig() interface{} { // StartedDefaultTestTenant is part of the serverutils.TestServerInterface. func (ts *TestServer) StartedDefaultTestTenant() bool { - return !ts.cfg.DisableDefaultTestTenant + return len(ts.testTenants) > 0 } // TenantOrServer is part of the serverutils.TestServerInterface. From dc6b2dc923a16108c164f93f3d72d5e742c1037f Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Tue, 18 Jul 2023 09:43:12 -0700 Subject: [PATCH 4/4] serverccl: fix TestVerifyPassword for test tenant We simply needed to use the ExecutorConfig of the test tenant if it was started. Release note: None --- pkg/ccl/serverccl/role_authentication_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/ccl/serverccl/role_authentication_test.go b/pkg/ccl/serverccl/role_authentication_test.go index 3c9861764bb4..b609d6d1ea13 100644 --- a/pkg/ccl/serverccl/role_authentication_test.go +++ b/pkg/ccl/serverccl/role_authentication_test.go @@ -33,12 +33,7 @@ func TestVerifyPassword(t *testing.T) { defer log.Scope(t).Close(t) ctx := context.Background() - s, db, _ := serverutils.StartServer(t, - base.TestServerArgs{ - // One of the sub-tests fails. - DefaultTestTenant: base.TestDoesNotWorkWithSecondaryTenantsButWeDontKnowWhyYet(106903), - }, - ) + s, db, _ := serverutils.StartServer(t, base.TestServerArgs{}) defer s.Stopper().Stop(ctx) ts := s.TenantOrServer() @@ -145,7 +140,7 @@ func TestVerifyPassword(t *testing.T) { {"user with VALID UNTIL NULL should succeed", "cthon98", "12345", false, false, true, true}, } { t.Run(tc.testName, func(t *testing.T) { - execCfg := s.ExecutorConfig().(sql.ExecutorConfig) + execCfg := ts.ExecutorConfig().(sql.ExecutorConfig) username := username.MakeSQLUsernameFromPreNormalizedString(tc.username) exists, canLoginSQL, canLoginDBConsole, canUseReplicationMode, isSuperuser, _, pwRetrieveFn, err := sql.GetUserSessionInitInfo( context.Background(), &execCfg, username, "", /* databaseName */