Skip to content

Commit 08e6fbe

Browse files
committed
roachtest: update liquibase test harness
This resolves an issue where the test started failing because of an outdated java version. Release note: None
1 parent 2a1771e commit 08e6fbe

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.SimpleSecureOption(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
}
@@ -98,7 +97,11 @@ sudo ln -sf /home/ubuntu/cockroach /cockroach/cockroach.sh`); err != nil {
9897
t.Fatal(err)
9998
}
10099
// TODO(darrylwong): once secure mode is enabled, add --certs-dir=install.CockroachNodeCertsDir
101-
if err = c.RunE(ctx, option.WithNodes(node), `/mnt/data1/liquibase-test-harness/src/test/resources/docker/setup_db.sh localhost`); err != nil {
100+
if err = c.RunE(
101+
ctx,
102+
option.WithNodes(node),
103+
fmt.Sprintf(`/mnt/data1/liquibase-test-harness/src/test/resources/docker/setup_db.sh localhost:%d`, startOpts.RoachprodOpts.SQLPort),
104+
); err != nil {
102105
t.Fatal(err)
103106
}
104107

@@ -109,21 +112,40 @@ sudo ln -sf /home/ubuntu/cockroach /cockroach/cockroach.sh`); err != nil {
109112

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

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

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

130+
// Load the list of all test results files and parse them individually.
131+
result, err := repeatRunWithDetailsSingleNode(
132+
ctx,
133+
c,
134+
t,
135+
node,
136+
"get list of test files",
137+
`ls `+resultsPath+`*.xml`,
138+
)
139+
if err != nil {
140+
t.Fatal(err)
141+
}
142+
143+
if len(result.Stdout) == 0 {
144+
t.Fatal("could not find any test result files")
145+
}
146+
125147
parseAndSummarizeJavaORMTestsResults(
126-
ctx, t, c, node, "liquibase" /* ormName */, []byte(resultsPath),
148+
ctx, t, c, node, "liquibase" /* ormName */, []byte(result.Stdout),
127149
blocklistName,
128150
expectedFailures,
129151
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)