Skip to content

Commit

Permalink
Merge #64502 #64660
Browse files Browse the repository at this point in the history
64502: roachtest: add pop test to nightlies r=otan a=rafiss

fixes #42342

Release note: None

64660: roachtest: fix liquibase test harness r=otan a=rafiss

There was an update upstream that added a test that does not work with
CockroachDB, so now we avoid running that test.

fixes #64460

Release note: None

Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
  • Loading branch information
craig[bot] and rafiss committed May 5, 2021
3 parents fb3f757 + 5b5eb96 + ddb23ab commit 8ac4cf4
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ go_library(
"pgjdbc_blocklist.go",
"pgx.go",
"pgx_blocklist.go",
"pop.go",
"psycopg.go",
"psycopg_blocklist.go",
"python_helpers.go",
Expand Down
7 changes: 4 additions & 3 deletions pkg/cmd/roachtest/liquibase.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down
104 changes: 104 additions & 0 deletions pkg/cmd/roachtest/pop.go
Original file line number Diff line number Diff line change
@@ -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<major>\d+)\.(?P<minor>\d+)\.(?P<point>\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,
})
}
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func registerTests(r *testRegistry) {
registerPgjdbc(r)
registerPgx(r)
registerNodeJSPostgres(r)
registerPop(r)
registerPsycopg(r)
registerQueue(r)
registerQuitAllNodes(r)
Expand Down

0 comments on commit 8ac4cf4

Please sign in to comment.