-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
roachtest: port import/mixed-versions to the new framework
There are some minor differences: - we no longer install fixtures (which weren't used anyway) - we'll probably run the IMPORT multiple times throughout the test run. Release note: None
- Loading branch information
1 parent
9f2d988
commit 39855f7
Showing
4 changed files
with
60 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2023 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package tests | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"math/rand" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster" | ||
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry" | ||
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/roachtestutil/mixedversion" | ||
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test" | ||
"github.com/cockroachdb/cockroach/pkg/roachprod/logger" | ||
) | ||
|
||
func registerImportMixedVersions(r registry.Registry) { | ||
r.Add(registry.TestSpec{ | ||
Name: "import/mixed-versions", | ||
Owner: registry.OwnerSQLQueries, | ||
Cluster: r.MakeClusterSpec(4), | ||
CompatibleClouds: registry.AllExceptAWS, | ||
Suites: registry.Suites(registry.Nightly), | ||
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) { | ||
warehouses := 100 | ||
if c.IsLocal() { | ||
warehouses = 10 | ||
} | ||
runImportMixedVersions(ctx, t, c, warehouses) | ||
}, | ||
}) | ||
} | ||
|
||
func runImportMixedVersions(ctx context.Context, t test.Test, c cluster.Cluster, warehouses int) { | ||
// NB: We rely on the testing framework to choose a random predecessor to | ||
// upgrade from. | ||
mvt := mixedversion.NewTest(ctx, t, t.L(), c, c.All()) | ||
runImport := func(ctx context.Context, l *logger.Logger, r *rand.Rand, h *mixedversion.Helper) error { | ||
if err := h.Exec(r, "DROP DATABASE IF EXISTS tpcc CASCADE;"); err != nil { | ||
return err | ||
} | ||
node := h.RandomNode(r, c.All()) | ||
cmd := tpccImportCmdWithCockroachBinary(test.DefaultCockroachPath, warehouses) + fmt.Sprintf(" {pgurl%s}", c.Node(node)) | ||
l.Printf("executing %q on node %d", cmd, node) | ||
return c.RunE(ctx, c.Node(node), cmd) | ||
} | ||
mvt.InMixedVersion("import", runImport) | ||
mvt.AfterUpgradeFinalized("import", runImport) | ||
mvt.Run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters