Skip to content

Commit

Permalink
Merge pull request #111316 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-22.2-111175

release-22.2: roachtest: fix flowable roachtest
  • Loading branch information
rafiss authored Sep 27, 2023
2 parents e090fac + f4baa9e commit 79ab45d
Showing 1 changed file with 75 additions and 3 deletions.
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 @@ -111,3 +154,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);
`

0 comments on commit 79ab45d

Please sign in to comment.