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

release-23.1: roachtest: fix flowable roachtest #111317

Merged
merged 1 commit into from
Sep 27, 2023
Merged
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
78 changes: 75 additions & 3 deletions pkg/cmd/roachtest/tests/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package tests

import (
"context"
"fmt"
"regexp"

"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
Expand Down Expand Up @@ -39,6 +40,29 @@ func registerFlowable(r registry.Registry) {
c.Put(ctx, t.Cockroach(), "./cockroach", c.All())
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), c.All())

t.Status("creating database used by tests")
db, err := c.ConnE(ctx, t.L(), node[0])
if err != nil {
t.Fatal(err)
}
defer db.Close()

if _, err := db.ExecContext(
ctx, `CREATE DATABASE flowable;`,
); err != nil {
t.Fatal(err)
}
if _, err := db.ExecContext(
ctx, `CREATE USER flowable;`,
); err != nil {
t.Fatal(err)
}
if _, err := db.ExecContext(
ctx, `GRANT admin TO flowable;`,
); err != nil {
t.Fatal(err)
}

t.Status("cloning flowable and installing prerequisites")
latestTag, err := repeatGetLatestTag(
ctx, t, "flowable", "flowable-engine", flowableReleaseTagRegex,
Expand All @@ -60,7 +84,7 @@ func registerFlowable(r registry.Registry) {
c,
node,
"install dependencies",
`sudo apt-get -qq install default-jre openjdk-8-jdk-headless gradle maven`,
`sudo apt-get -qq install default-jre openjdk-17-jdk-headless gradle maven`,
); err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -90,13 +114,32 @@ func registerFlowable(r registry.Registry) {
c,
node,
"building Flowable",
`cd /mnt/data1/flowable-engine/ && mvn clean install -DskipTests`,
`cd /mnt/data1/flowable-engine/ && ./mvnw clean install -DskipTests`,
); err != nil {
t.Fatal(err)
}

if err := repeatRunE(
ctx,
t,
c,
node,
"configuring tests for cockroachdb",
fmt.Sprintf(`mkdir -p $HOME/.flowable/jdbc/ && \
echo "%s" > $HOME/.flowable/jdbc/build.flowable6.cockroachdb.properties && \
cd /mnt/data1/flowable-engine/ && \
echo '%s' > flowable_crdb.patch && \
git apply --ignore-whitespace flowable_crdb.patch && \
grep "force-commit" . -lr | xargs sed -i 's/-- force-commit//g'`,
flowableParams, flowablePatch,
),
); err != nil {
t.Fatal(err)
}

if err := c.RunE(ctx, node,
`cd /mnt/data1/flowable-engine/ && mvn clean test -Dtest=Flowable6Test#testLongServiceTaskLoop -Ddb=crdb`,
`cd /mnt/data1/flowable-engine/ && \
./mvnw clean test -Dtest=Flowable6Test#testLongServiceTaskLoop -Ddatabase=cockroachdb`,
); err != nil {
t.Fatal(err)
}
Expand All @@ -112,3 +155,32 @@ func registerFlowable(r registry.Registry) {
},
})
}

const flowableParams = `
jdbc.url=jdbc:postgresql://127.0.0.1:26257/flowable?sslmode=disable
jdbc.driver=org.postgresql.Driver
jdbc.username=flowable
jdbc.password
`

// This patch will not be needed once https://github.com/flowable/flowable-engine/pull/3752
// is merged.
const flowablePatch = `
diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java
index 38a332b785..620ed787bf 100644
--- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java
+++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java
@@ -101,6 +101,12 @@ public class TableDataManagerImpl implements TableDataManager {
List<String> tableNames = new ArrayList<>();
try (ResultSet tables = databaseMetaData.getTables(catalog, schema, tableNameFilter, DbSqlSession.JDBC_METADATA_TABLE_TYPES)) {
while (tables.next()) {
+ if ("cockroachdb".equals(getDbSqlSession().getDbSqlSessionFactory().getDatabaseType())) {
+ String schemaName = tables.getString("TABLE_SCHEM");
+ if ("crdb_internal".equals(schemaName)) {
+ continue;
+ }
+ }
String tableName = tables.getString("TABLE_NAME");
tableName = tableName.toUpperCase(Locale.ROOT);
tableNames.add(tableName);
`