diff --git a/pkg/cmd/roachtest/BUILD.bazel b/pkg/cmd/roachtest/BUILD.bazel index 30111980e273..c4f28f13cf41 100644 --- a/pkg/cmd/roachtest/BUILD.bazel +++ b/pkg/cmd/roachtest/BUILD.bazel @@ -79,6 +79,7 @@ go_library( "pgjdbc_blocklist.go", "pgx.go", "pgx_blocklist.go", + "pop.go", "psycopg.go", "psycopg_blocklist.go", "python_helpers.go", diff --git a/pkg/cmd/roachtest/liquibase.go b/pkg/cmd/roachtest/liquibase.go index d3b9fd7acf30..7ee9a302f3a8 100644 --- a/pkg/cmd/roachtest/liquibase.go +++ b/pkg/cmd/roachtest/liquibase.go @@ -12,8 +12,9 @@ package main import "context" -// This test runs the Liquibase test harness against a single cockroach node. +var supportedLiquibaseHarnessTag = "liquibase-test-harness-1.0.1" +// This test runs the Liquibase test harness against a single cockroach node. func registerLiquibase(r *testRegistry) { runLiquibase := func( ctx context.Context, @@ -74,7 +75,7 @@ func registerLiquibase(r *testRegistry) { c, "https://github.com/liquibase/liquibase-test-harness.git", "/mnt/data1/liquibase-test-harness", - "main", + supportedLiquibaseHarnessTag, node, ); err != nil { t.Fatal(err) @@ -92,7 +93,7 @@ func registerLiquibase(r *testRegistry) { // The dbVersion is set to 20.2 since that causes all known passing tests // to be run. if err = c.RunE(ctx, node, - `cd /mnt/data1/liquibase-test-harness/ && mvn test -DdbName=cockroachdb -DdbVersion=20.2`, + `cd /mnt/data1/liquibase-test-harness/ && mvn test -Dtest=LiquibaseHarnessSuiteTest -DdbName=cockroachdb -DdbVersion=20.2`, ); err != nil { t.Fatal(err) } diff --git a/pkg/cmd/roachtest/pop.go b/pkg/cmd/roachtest/pop.go new file mode 100644 index 000000000000..3740482de76c --- /dev/null +++ b/pkg/cmd/roachtest/pop.go @@ -0,0 +1,104 @@ +// Copyright 2021 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 main + +import ( + "context" + "fmt" + "regexp" + + "github.com/stretchr/testify/require" +) + +var popReleaseTag = regexp.MustCompile(`^v(?P\d+)\.(?P\d+)\.(?P\d+)$`) +var popSupportedTag = "v5.3.3" + +func registerPop(r *testRegistry) { + runPop := func(ctx context.Context, t *test, c *cluster) { + if c.isLocal() { + t.Fatal("cannot be run in local mode") + } + node := c.Node(1) + t.Status("setting up cockroach") + c.Put(ctx, cockroach, "./cockroach", c.All()) + c.Start(ctx, t, c.All()) + version, err := fetchCockroachVersion(ctx, c, node[0], nil) + if err != nil { + t.Fatal(err) + } + if err := alterZoneConfigAndClusterSettings(ctx, version, c, node[0], nil); err != nil { + t.Fatal(err) + } + + t.Status("cloning pop and installing prerequisites") + latestTag, err := repeatGetLatestTag( + ctx, c, "gobuffalo", "pop", popReleaseTag) + if err != nil { + t.Fatal(err) + } + c.l.Printf("Latest pop release is %s.", latestTag) + c.l.Printf("Supported pop release is %s.", popSupportedTag) + + installGolang(ctx, t, c, node) + + const ( + popPath = "/mnt/data1/pop/" + ) + + // Remove any old pop installations + if err := repeatRunE( + ctx, c, node, "remove old pop", fmt.Sprintf("rm -rf %s", popPath), + ); err != nil { + t.Fatal(err) + } + + if err := repeatGitCloneE( + ctx, + t.l, + c, + "https://github.com/gobuffalo/pop.git", + popPath, + popSupportedTag, + node, + ); err != nil { + t.Fatal(err) + } + + t.Status("building and setting up tests") + + err = c.RunE(ctx, node, fmt.Sprintf(`cd %s && go build -v -tags sqlite -o tsoda ./soda`, popPath)) + require.NoError(t, err) + + err = c.RunE(ctx, node, fmt.Sprintf(`cd %s && ./tsoda drop -e cockroach -c ./database.yml -p ./testdata/migrations`, popPath)) + require.NoError(t, err) + + err = c.RunE(ctx, node, fmt.Sprintf(`cd %s && ./tsoda create -e cockroach -c ./database.yml -p ./testdata/migrations`, popPath)) + require.NoError(t, err) + + err = c.RunE(ctx, node, fmt.Sprintf(`cd %s && ./tsoda migrate -e cockroach -c ./database.yml -p ./testdata/migrations`, popPath)) + require.NoError(t, err) + + t.Status("running pop test suite") + + // No tests are expected to fail. + err = c.RunE(ctx, node, fmt.Sprintf(`cd %s && SODA_DIALECT=cockroach go test -race -tags sqlite -v ./... -count=1`, popPath)) + require.NoError(t, err, "error while running pop tests") + } + + r.Add(testSpec{ + Name: "pop", + Owner: OwnerSQLExperience, + MinVersion: "v20.2.0", + Cluster: makeClusterSpec(1), + Tags: []string{`default`, `orm`}, + Run: runPop, + }) +} diff --git a/pkg/cmd/roachtest/registry.go b/pkg/cmd/roachtest/registry.go index a60b4d8a270d..f2414f7052b8 100644 --- a/pkg/cmd/roachtest/registry.go +++ b/pkg/cmd/roachtest/registry.go @@ -72,6 +72,7 @@ func registerTests(r *testRegistry) { registerPgjdbc(r) registerPgx(r) registerNodeJSPostgres(r) + registerPop(r) registerPsycopg(r) registerQueue(r) registerQuitAllNodes(r)