From eedde779b2f72b2dc02cf2d5711d4410072ec6fc Mon Sep 17 00:00:00 2001 From: Herko Lategan Date: Wed, 6 Dec 2023 15:38:18 +0000 Subject: [PATCH] roachtest: remove unused functions from multitenant utils Epic: None Release Note: None --- .../roachtest/tests/multitenant_distsql.go | 1 + pkg/cmd/roachtest/tests/multitenant_utils.go | 48 ------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/pkg/cmd/roachtest/tests/multitenant_distsql.go b/pkg/cmd/roachtest/tests/multitenant_distsql.go index 55145be2c3ab..e69949784541 100644 --- a/pkg/cmd/roachtest/tests/multitenant_distsql.go +++ b/pkg/cmd/roachtest/tests/multitenant_distsql.go @@ -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) diff --git a/pkg/cmd/roachtest/tests/multitenant_utils.go b/pkg/cmd/roachtest/tests/multitenant_utils.go index 3ad051cc6d04..722bc1a1c64f 100644 --- a/pkg/cmd/roachtest/tests/multitenant_utils.go +++ b/pkg/cmd/roachtest/tests/multitenant_utils.go @@ -16,8 +16,6 @@ import ( "fmt" "math/rand" "net/url" - "os" - "path/filepath" "strconv" "strings" "time" @@ -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, @@ -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"