Skip to content

Commit

Permalink
roachtest: preserve certs in multitenant_tpch
Browse files Browse the repository at this point in the history
The `loadTPCHDataset` function was unconditionally removing certs when
the cluster was wiped. In this commit, we add a parameter to that
function to indicate if the cluster being used is `secure`; if so, we
preserve the certs when wiping.

Fixes: cockroachdb#105880

Release note: None
  • Loading branch information
renatolabs committed Jul 10, 2023
1 parent a9f88ec commit ba00a07
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func registerCancel(r registry.Registry) {

t.Status("restoring TPCH dataset for Scale Factor 1")
if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false, /* disableMergeQueue */
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false /* disableMergeQueue */, false, /* secure */
); err != nil {
t.Fatal(err)
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/roachtest/tests/multitenant_tpch.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ import (
func runMultiTenantTPCH(
ctx context.Context, t test.Test, c cluster.Cluster, enableDirectScans bool,
) {
secure := true
c.Put(ctx, t.Cockroach(), "./cockroach", c.All())
c.Put(ctx, t.DeprecatedWorkload(), "./workload", c.Node(1))
c.Start(ctx, t.L(), option.DefaultStartOptsNoBackups(), install.MakeClusterSettings(install.SecureOption(true)), c.All())
c.Start(ctx, t.L(), option.DefaultStartOptsNoBackups(), install.MakeClusterSettings(install.SecureOption(secure)), c.All())

setupNames := []string{"single-tenant", "multi-tenant"}
const numRunsPerQuery = 3
Expand All @@ -50,7 +51,7 @@ func runMultiTenantTPCH(
}
t.Status("restoring TPCH dataset for Scale Factor 1 in ", setupNames[setupIdx])
if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false, /* disableMergeQueue */
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false /* disableMergeQueue */, secure,
); err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/roachtest/tests/tpc_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func loadTPCHDataset(
m cluster.Monitor,
roachNodes option.NodeListOption,
disableMergeQueue bool,
secure bool,
) (retErr error) {
if c.Spec().Cloud != spec.GCE {
t.Skip("uses gs://cockroach-fixtures; see https://github.com/cockroachdb/cockroach/issues/105968")
Expand Down Expand Up @@ -93,7 +94,7 @@ func loadTPCHDataset(
// If the scale factor was smaller than the required scale factor, wipe the
// cluster and restore.
m.ExpectDeaths(int32(c.Spec().NodeCount))
c.Wipe(ctx, false /* preserveCerts */, roachNodes)
c.Wipe(ctx, secure, roachNodes)
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), roachNodes)
m.ResetDeaths()
} else if pqErr := (*pq.Error)(nil); !(errors.As(err, &pqErr) &&
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpch_concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func registerTPCHConcurrency(r registry.Registry) {

if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx, c.Range(1, numNodes-1)),
c.Range(1, numNodes-1), true, /* disableMergeQueue */
c.Range(1, numNodes-1), true /* disableMergeQueue */, false, /* secure */
); err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpchbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func runTPCHBench(ctx context.Context, t test.Test, c cluster.Cluster, b tpchBen

t.Status("setting up dataset")
err := loadTPCHDataset(
ctx, t, c, conn, b.ScaleFactor, m, roachNodes, true, /* disableMergeQueue */
ctx, t, c, conn, b.ScaleFactor, m, roachNodes, true /* disableMergeQueue */, false, /* secure */
)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpchvec.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func runTPCHVec(
conn := c.Conn(ctx, t.L(), 1)
t.Status("restoring TPCH dataset for Scale Factor 1")
if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), true, /* disableMergeQueue */
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), true /* disableMergeQueue */, false, /* secure */
); err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit ba00a07

Please sign in to comment.