Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roachtest: add pop test to nightlies #64502

Merged
merged 1 commit into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ go_library(
"pgjdbc_blocklist.go",
"pgx.go",
"pgx_blocklist.go",
"pop.go",
"psycopg.go",
"psycopg_blocklist.go",
"python_helpers.go",
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