Skip to content

Commit 9f09595

Browse files
authored
Merge pull request #154919 from rafiss/blathers/backport-release-24.1-154801
release-24.1: roachtest: update liquibase test harness
2 parents 0a840a3 + 426f6f8 commit 9f09595

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

pkg/cmd/roachtest/tests/liquibase.go

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ import (
1313
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
1414
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
1515
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
16-
"github.com/cockroachdb/cockroach/pkg/roachprod/config"
1716
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
1817
)
1918

20-
var supportedLiquibaseHarnessCommit = "1790ddef2d0339c5c96839ac60ac424c130dadd8"
19+
var supportedLiquibaseHarnessCommit = "f43b967d60aa4ce7056a6d6ee0bc6d9f144c62d5"
2120

2221
// This test runs the Liquibase test harness against a single cockroach node.
2322
func registerLiquibase(r registry.Registry) {
@@ -32,7 +31,8 @@ func registerLiquibase(r registry.Registry) {
3231
node := c.Node(1)
3332
t.Status("setting up cockroach")
3433
startOpts := option.DefaultStartOpts()
35-
startOpts.RoachprodOpts.SQLPort = config.DefaultSQLPort
34+
// The liquibase-test-harness expects CockroachDB to be on port 26263.
35+
startOpts.RoachprodOpts.SQLPort = 26263
3636
// TODO(darrylwong): if https://github.com/liquibase/liquibase-test-harness/pull/724 is merged, enable secure mode
3737
c.Start(ctx, t.L(), startOpts, install.MakeClusterSettings(install.SecureOption(false)), c.All())
3838

@@ -58,14 +58,13 @@ func registerLiquibase(r registry.Registry) {
5858
t.Fatal(err)
5959
}
6060

61-
// TODO(rafi): use openjdk-11-jdk-headless once we are off of Ubuntu 16.
6261
if err := repeatRunE(
6362
ctx,
6463
t,
6564
c,
6665
node,
6766
"install dependencies",
68-
`sudo apt-get -qq install default-jre openjdk-8-jdk-headless maven`,
67+
`sudo apt-get -qq install default-jre openjdk-17-jdk-headless maven`,
6968
); err != nil {
7069
t.Fatal(err)
7170
}
@@ -77,8 +76,8 @@ func registerLiquibase(r registry.Registry) {
7776
t.Fatal(err)
7877
}
7978

80-
// TODO(richardjcai): When liquibase-test-harness 1.0.3 is released and tagged,
81-
// use the tag version instead of the commit.
79+
// TODO(sql-foundations): When liquibase-test-harness 1.0.12 is released and
80+
// tagged, use the tag version instead of the commit.
8281
if err = c.RunE(ctx, option.WithNodes(node), "cd /mnt/data1/ && git clone https://github.com/liquibase/liquibase-test-harness.git"); err != nil {
8382
t.Fatal(err)
8483
}
@@ -95,7 +94,11 @@ func registerLiquibase(r registry.Registry) {
9594
t.Fatal(err)
9695
}
9796
// TODO(darrylwong): once secure mode is enabled, add --certs-dir=install.CockroachNodeCertsDir
98-
if err = c.RunE(ctx, option.WithNodes(node), `/mnt/data1/liquibase-test-harness/src/test/resources/docker/setup_db.sh localhost`); err != nil {
97+
if err = c.RunE(
98+
ctx,
99+
option.WithNodes(node),
100+
fmt.Sprintf(`/mnt/data1/liquibase-test-harness/src/test/resources/docker/setup_db.sh localhost:%d`, startOpts.RoachprodOpts.SQLPort),
101+
); err != nil {
99102
t.Fatal(err)
100103
}
101104

@@ -106,21 +109,40 @@ func registerLiquibase(r registry.Registry) {
106109

107110
const (
108111
repoDir = "/mnt/data1/liquibase-test-harness"
109-
resultsPath = repoDir + "/target/surefire-reports/TEST-liquibase.harness.LiquibaseHarnessSuiteTest.xml"
112+
resultsPath = repoDir + "/target/surefire-reports/"
110113
)
111114

115+
// The Liquibase test harness currently has fixtures for 23.1, 23.2,
116+
// and 24.1. We use the 24.1 here since its the most recent one.
112117
// TODO(darrylwong): once secure mode is enabled, add -DdbUsername=roach -DdbPassword=system
113118
cmd := fmt.Sprintf("cd /mnt/data1/liquibase-test-harness/ && "+
114119
"mvn surefire-report:report-only test -Dtest=LiquibaseHarnessSuiteTest "+
115-
"-DdbName=cockroachdb -DdbVersion=20.2 -DoutputDirectory=%s", repoDir)
120+
"-DdbName=cockroachdb -DdbVersion=24.1 -DoutputDirectory=%s", repoDir)
116121

117122
err = c.RunE(ctx, option.WithNodes(node), cmd)
118123
if err != nil {
119124
t.L().Printf("error whilst running tests (may be expected): %#v", err)
120125
}
121126

127+
// Load the list of all test results files and parse them individually.
128+
result, err := repeatRunWithDetailsSingleNode(
129+
ctx,
130+
c,
131+
t,
132+
node,
133+
"get list of test files",
134+
`ls `+resultsPath+`*.xml`,
135+
)
136+
if err != nil {
137+
t.Fatal(err)
138+
}
139+
140+
if len(result.Stdout) == 0 {
141+
t.Fatal("could not find any test result files")
142+
}
143+
122144
parseAndSummarizeJavaORMTestsResults(
123-
ctx, t, c, node, "liquibase" /* ormName */, []byte(resultsPath),
145+
ctx, t, c, node, "liquibase" /* ormName */, []byte(result.Stdout),
124146
blocklistName,
125147
expectedFailures,
126148
ignoreList,

pkg/cmd/roachtest/tests/liquibase_blocklist.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@
55

66
package tests
77

8-
var liquibaseBlocklist = blocklist{
9-
"liquibase.harness.change.ChangeObjectTests.apply addAutoIncrement against cockroachdb 20.2": "unknown",
10-
"liquibase.harness.change.ChangeObjectTests.apply addCheckConstraint against cockroachdb 20.2": "unknown",
11-
"liquibase.harness.change.ChangeObjectTests.apply addDefaultValueSequenceNext against cockroachdb 20.2": "unknown",
12-
"liquibase.harness.change.ChangeObjectTests.apply alterSequence against cockroachdb 20.2": "unknown",
13-
"liquibase.harness.change.ChangeObjectTests.apply createPackage against cockroachdb 20.2": "unknown",
14-
"liquibase.harness.change.ChangeObjectTests.apply createSequence against cockroachdb 20.2": "unknown",
15-
"liquibase.harness.change.ChangeObjectTests.apply dropCheckConstraint against cockroachdb 20.2": "unknown",
16-
"liquibase.harness.change.ChangeObjectTests.apply dropSequence against cockroachdb 20.2": "unknown",
17-
"liquibase.harness.change.ChangeObjectTests.apply renameSequence against cockroachdb 20.2": "unknown",
18-
}
8+
var liquibaseBlocklist = blocklist{}
199

20-
var liquibaseIgnorelist = blocklist{}
10+
var liquibaseIgnorelist = blocklist{
11+
`liquibase.harness.change.ChangeObjectTests.apply addCheckConstraint against cockroachdb 24.1`: "requires enterprise version of liquibase",
12+
`liquibase.harness.change.ChangeObjectTests.apply createPackage against cockroachdb 24.1`: "requires enterprise version of liquibase",
13+
`liquibase.harness.change.ChangeObjectTests.apply dropCheckConstraint against cockroachdb 24.1`: "requires enterprise version of liquibase",
14+
}

0 commit comments

Comments
 (0)