Skip to content

Commit

Permalink
roachtest: fix gorm test
Browse files Browse the repository at this point in the history
This required using the new version and also excluding one of the new
test files.

Release note: None
  • Loading branch information
rafiss committed Oct 12, 2022
1 parent 2a9f158 commit 7722989
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 32 deletions.
14 changes: 8 additions & 6 deletions pkg/cmd/roachtest/tests/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

var gormReleaseTag = regexp.MustCompile(`^v(?P<major>\d+)\.(?P<minor>\d+)\.(?P<point>\d+)$`)
var gormSupportedTag = "v1.23.8"
var gormSupportedTag = "v1.24.0"

func registerGORM(r registry.Registry) {
runGORM := func(ctx context.Context, t test.Test, c cluster.Cluster) {
Expand Down Expand Up @@ -93,10 +93,8 @@ func registerGORM(r registry.Registry) {
t.Fatal(err)
}

blocklistName, expectedFailures, ignorelistName, ignoredFailures := gormBlocklists.getLists(version)
if expectedFailures == nil {
t.Fatalf("No gorm blocklist defined for cockroach version %s", version)
}
blocklistName, expectedFailures := "gormBlocklist", gormBlocklist
ignorelistName, ignoredFailures := "gormIgnorelist", gormIgnorelist
t.L().Printf("Running cockroach version %s, using blocklist %s, using ignorelist %s", version, blocklistName, ignorelistName)

err = c.RunE(ctx, node, `./cockroach sql -e "CREATE DATABASE gorm" --insecure`)
Expand All @@ -113,10 +111,14 @@ func registerGORM(r registry.Registry) {
t.Status("running gorm test suite and collecting results")

// Ignore the error as there will be failing tests.
// TODO(rafi): migrate_test.go is removed here since it relies on
// multi-dimensional arrays, which aren't supported, and leads to a panic in
// the test runner.
err = c.RunE(
ctx,
node,
fmt.Sprintf(`cd %s && GORM_DIALECT="postgres" GORM_DSN="user=root password= dbname=gorm host=localhost port=26257 sslmode=disable"
fmt.Sprintf(`cd %s && rm migrate_test.go &&
GORM_DIALECT="postgres" GORM_DSN="user=root password= dbname=gorm host=localhost port=26257 sslmode=disable"
go test -v ./... 2>&1 | %s/bin/go-junit-report > %s`,
gormTestPath, goPath, resultsPath),
)
Expand Down
28 changes: 2 additions & 26 deletions pkg/cmd/roachtest/tests/gorm_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,6 @@

package tests

var gormBlocklists = blocklistsForVersion{
{"v20.2", "gormBlocklist20_2", gormBlocklist20_2, "gormIgnorelist20_2", gormIgnorelist20_2},
{"v21.1", "gormBlocklist21_1", gormBlocklist21_1, "gormIgnorelist21_1", gormIgnorelist21_1},
{"v21.2", "gormBlocklist21_2", gormBlocklist21_2, "gormIgnorelist21_2", gormIgnorelist21_2},
{"v22.1", "gormBlocklist22_1", gormBlocklist22_1, "gormIgnorelist22_1", gormIgnorelist22_1},
{"v22.2", "gormBlocklist22_2", gormBlocklist22_2, "gormIgnorelist22_2", gormIgnorelist22_2},
}
var gormBlocklist = blocklist{}

var gormBlocklist22_2 = gormBlocklist22_1

var gormBlocklist22_1 = gormBlocklist21_2

var gormBlocklist21_2 = gormBlocklist21_1

var gormBlocklist21_1 = gormBlocklist20_2

var gormBlocklist20_2 = blocklist{}

var gormIgnorelist22_2 = gormIgnorelist22_1

var gormIgnorelist22_1 = gormIgnorelist21_2

var gormIgnorelist21_2 = gormIgnorelist21_1

var gormIgnorelist21_1 = gormIgnorelist20_2

var gormIgnorelist20_2 = blocklist{}
var gormIgnorelist = blocklist{}

0 comments on commit 7722989

Please sign in to comment.