Skip to content

Commit

Permalink
roachtest: remove unused functions from multitenant utils
Browse files Browse the repository at this point in the history
Epic: None
Release Note: None
  • Loading branch information
herkolategan committed Dec 11, 2023
1 parent 2a0b01d commit fd14aa1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/multitenant_distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func runMultiTenantDistSQL(
// Open bundle and verify its contents
sqlConnCtx := clisqlclient.Context{}
pgURL, err := c.ExternalPGUrl(ctx, t.L(), c.Node(1), tenantName, 0)
require.NoError(t, err)
conn := sqlConnCtx.MakeSQLConn(io.Discard, io.Discard, pgURL[0])
bundles, err := clisqlclient.StmtDiagListBundles(ctx, conn)
require.NoError(t, err)
Expand Down
48 changes: 0 additions & 48 deletions pkg/cmd/roachtest/tests/multitenant_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
"fmt"
"math/rand"
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -63,14 +61,6 @@ type createTenantOptions struct {
}
type createTenantOpt func(*createTenantOptions)

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

func createTenantEnvVar(envVar string) createTenantOpt {
return func(c *createTenantOptions) { c.envVars = append(c.envVars, envVar) }
}

func createTenantNodeInternal(
ctx context.Context,
t test.Test,
Expand Down Expand Up @@ -284,44 +274,6 @@ func startTenantServer(
return errCh
}

func newTenantInstance(
ctx context.Context, tn *tenantNode, t test.Test, c cluster.Cluster, node, http, sql int,
) (*tenantNode, error) {
instID := tenantIds[tn.tenantID] + 1
tenantIds[tn.tenantID] = instID
inst := tenantNode{
tenantID: tn.tenantID,
instanceID: instID,
kvAddrs: tn.kvAddrs,
node: node,
httpPort: http,
sqlPort: sql,
envVars: tn.envVars,
}
tenantCertsDir, err := os.MkdirTemp("", "tenant-certs")
if err != nil {
return nil, err
}
key, crt := fmt.Sprintf("client-tenant.%d.key", tn.tenantID), fmt.Sprintf("client-tenant.%d.crt", tn.tenantID)
err = c.Get(ctx, t.L(), filepath.Join("certs", key), filepath.Join(tenantCertsDir, key), c.Node(tn.node))
if err != nil {
return nil, err
}
err = c.Get(ctx, t.L(), filepath.Join("certs", crt), filepath.Join(tenantCertsDir, crt), c.Node(tn.node))
if err != nil {
return nil, err
}
c.Put(ctx, filepath.Join(tenantCertsDir, key), filepath.Join("certs", key), c.Node(node))
c.Put(ctx, filepath.Join(tenantCertsDir, crt), filepath.Join("certs", crt), c.Node(node))
// sigh: locally theses are symlinked which breaks our crypto cert checks
if c.IsLocal() {
c.Run(ctx, c.Node(node), "rm", filepath.Join("certs", key))
c.Run(ctx, c.Node(node), "cp", filepath.Join(tenantCertsDir, key), filepath.Join("certs", key))
}
c.Run(ctx, c.Node(node), "chmod", "0600", filepath.Join("certs", key))
return &inst, nil
}

// createTenantAdminRole creates a role that can be used to log into a secure cluster's db console.
func createTenantAdminRole(t test.Test, tenantName string, tenantSQL *sqlutils.SQLRunner) {
username := "secure"
Expand Down

0 comments on commit fd14aa1

Please sign in to comment.