Skip to content

Commit

Permalink
roachtest: remove unused create tenant options
Browse files Browse the repository at this point in the history
The `otherTenantIDs` field on `createTenantOptions` is no longer used.

Epic: CRDB-23559
  • Loading branch information
herkolategan committed Jun 13, 2023
1 parent 6693bef commit 06cd54a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ func runMultiTenantFairness(

// Create the tenants.
t.L().Printf("initializing %d tenants (<%s)", numTenants, 5*time.Minute)
tenantIDs := make([]int, 0, numTenants)
for i := 0; i < numTenants; i++ {
tenantIDs = append(tenantIDs, tenantID(i))
}

tenants := make([]*tenantNode, numTenants)
for i := 0; i < numTenants; i++ {
if !t.SkipInit() {
Expand All @@ -216,8 +211,7 @@ func runMultiTenantFairness(
}

tenant := createTenantNode(ctx, t, c,
crdbNode, tenantID(i), tenantNodeID(i), tenantHTTPPort(i), tenantSQLPort(i),
createTenantOtherTenantIDs(tenantIDs))
crdbNode, tenantID(i), tenantNodeID(i), tenantHTTPPort(i), tenantSQLPort(i))
defer tenant.stop(ctx, t, c)

tenants[i] = tenant
Expand Down
11 changes: 5 additions & 6 deletions pkg/cmd/roachtest/tests/multitenant_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func runMultiTenantUpgrade(ctx context.Context, t test.Test, c cluster.Cluster,

settings := install.MakeClusterSettings(install.BinaryOption(predecessorBinary), install.SecureOption(true))
c.Start(ctx, t.L(), option.DefaultStartOpts(), settings, kvNodes)
tenantStartOpt := createTenantOtherTenantIDs([]int{11, 12, 13, 14})

const tenant11aHTTPPort, tenant11aSQLPort = 8011, 20011
const tenant11bHTTPPort, tenant11bSQLPort = 8016, 20016
Expand All @@ -98,13 +97,13 @@ func runMultiTenantUpgrade(ctx context.Context, t test.Test, c cluster.Cluster,
// Create two instances of tenant 11 so that we can test with two pods
// running during migration.
const tenantNode = 2
tenant11a := createTenantNode(ctx, t, c, kvNodes, tenant11ID, tenantNode, tenant11aHTTPPort, tenant11aSQLPort, tenantStartOpt)
tenant11a := createTenantNode(ctx, t, c, kvNodes, tenant11ID, tenantNode, tenant11aHTTPPort, tenant11aSQLPort)
tenant11a.start(ctx, t, c, predecessorBinary)
defer tenant11a.stop(ctx, t, c)

// Since the certs are created with the createTenantNode call above, we
// call the "no certs" version of create tenant here.
tenant11b := createTenantNodeNoCerts(ctx, t, c, kvNodes, tenant11ID, tenantNode, tenant11bHTTPPort, tenant11bSQLPort, tenantStartOpt)
tenant11b := createTenantNodeNoCerts(ctx, t, c, kvNodes, tenant11ID, tenantNode, tenant11bHTTPPort, tenant11bSQLPort)
tenant11b.start(ctx, t, c, predecessorBinary)
defer tenant11b.stop(ctx, t, c)

Expand Down Expand Up @@ -159,7 +158,7 @@ func runMultiTenantUpgrade(ctx context.Context, t test.Test, c cluster.Cluster,
withResults([][]string{{"1", "bar"}}))

t.Status("starting tenant 12 server with older binary")
tenant12 := createTenantNode(ctx, t, c, kvNodes, tenant12ID, tenantNode, tenant12HTTPPort, tenant12SQLPort, tenantStartOpt)
tenant12 := createTenantNode(ctx, t, c, kvNodes, tenant12ID, tenantNode, tenant12HTTPPort, tenant12SQLPort)
tenant12.start(ctx, t, c, predecessorBinary)
defer tenant12.stop(ctx, t, c)

Expand All @@ -181,7 +180,7 @@ func runMultiTenantUpgrade(ctx context.Context, t test.Test, c cluster.Cluster,
runner.Exec(t, `SELECT crdb_internal.create_tenant($1::INT)`, tenant13ID)

t.Status("starting tenant 13 server with new binary")
tenant13 := createTenantNode(ctx, t, c, kvNodes, tenant13ID, tenantNode, tenant13HTTPPort, tenant13SQLPort, tenantStartOpt)
tenant13 := createTenantNode(ctx, t, c, kvNodes, tenant13ID, tenantNode, tenant13HTTPPort, tenant13SQLPort)
tenant13.start(ctx, t, c, currentBinary)
defer tenant13.stop(ctx, t, c)

Expand Down Expand Up @@ -332,7 +331,7 @@ func runMultiTenantUpgrade(ctx context.Context, t test.Test, c cluster.Cluster,
runner.Exec(t, `SELECT crdb_internal.create_tenant($1::INT)`, tenant14ID)

t.Status("verifying that the tenant 14 server works and has the proper version")
tenant14 := createTenantNode(ctx, t, c, kvNodes, tenant14ID, tenantNode, tenant14HTTPPort, tenant14SQLPort, tenantStartOpt)
tenant14 := createTenantNode(ctx, t, c, kvNodes, tenant14ID, tenantNode, tenant14HTTPPort, tenant14SQLPort)
tenant14.start(ctx, t, c, currentBinary)
defer tenant14.stop(ctx, t, c)
verifySQL(t, tenant14.pgURL,
Expand Down
11 changes: 0 additions & 11 deletions pkg/cmd/roachtest/tests/multitenant_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,11 @@ type tenantNode struct {
}

type createTenantOptions struct {
// TODO(ssd): This is a hack to work around the currently tangled state of
// cluster management between roachtest and roachprod. createTenantNode
// recreates client certs. Only one copy of the client certs are cached
// locally, so if we want a client to work against multiple tenants in a
// single test, we need to create the certs with all tenants.
otherTenantIDs []int

// Set this to expand the scope of the nodes added to the tenant certs.
certNodes option.NodeListOption
}
type createTenantOpt func(*createTenantOptions)

func createTenantOtherTenantIDs(ids []int) createTenantOpt {
return func(c *createTenantOptions) { c.otherTenantIDs = ids }
}

func createTenantCertNodes(nodes option.NodeListOption) createTenantOpt {
return func(c *createTenantOptions) { c.certNodes = nodes }
}
Expand Down

0 comments on commit 06cd54a

Please sign in to comment.