Skip to content

Commit a702350

Browse files
committed
HHH-14892 Enable parallel testing for EDB
1 parent 8ddcf7f commit a702350

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

docker_db.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ edb_13() {
276276
(cd edb; $CONTAINER_CLI build -t edb-test:13 -f edb13.Dockerfile .)
277277
fi
278278
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d $DB_IMAGE_EDB
279+
edb_setup
279280
}
280281

281282
edb_14() {
@@ -286,6 +287,7 @@ edb_14() {
286287
(cd edb; $CONTAINER_CLI build -t edb-test:14 -f edb14.Dockerfile .)
287288
fi
288289
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d $DB_IMAGE_EDB
290+
edb_setup
289291
}
290292

291293
edb_15() {
@@ -296,6 +298,7 @@ edb_15() {
296298
(cd edb; $CONTAINER_CLI build -t edb-test:15 -f edb15.Dockerfile .)
297299
fi
298300
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d $DB_IMAGE_EDB
301+
edb_setup
299302
}
300303

301304
edb_16() {
@@ -306,6 +309,7 @@ edb_16() {
306309
(cd edb; $CONTAINER_CLI build -t edb-test:16 -f edb16.Dockerfile .)
307310
fi
308311
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d $DB_IMAGE_EDB
312+
edb_setup
309313
}
310314

311315
edb_17() {
@@ -316,6 +320,28 @@ edb_17() {
316320
(cd edb; $CONTAINER_CLI build -t edb-test:17 -f edb17.Dockerfile .)
317321
fi
318322
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d $DB_IMAGE_EDB
323+
edb_setup
324+
}
325+
326+
edb_setup() {
327+
databases=()
328+
for n in $(seq 1 $(($(nproc)/2)))
329+
do
330+
databases+=("hibernate_orm_test_${n}")
331+
done
332+
create_cmd=
333+
for i in "${!databases[@]}";do
334+
create_cmd+="psql -U hibernate_orm_test -d postgres -c \"create database ${databases[i]};\";"
335+
done
336+
$CONTAINER_CLI exec edb bash -c "until pg_isready -U hibernate_orm_test; do sleep 1; done"
337+
# Database seems to restart after it was ready once, so give it some time
338+
sleep 1
339+
$CONTAINER_CLI exec edb bash -c "until pg_isready -U hibernate_orm_test; do sleep 1; done"
340+
$CONTAINER_CLI exec edb bash -c "${create_cmd}"
341+
$CONTAINER_CLI exec edb bash -c 'psql -U hibernate_orm_test -d hibernate_orm_test -c "create extension vector;"'
342+
for i in "${!databases[@]}";do
343+
$CONTAINER_CLI exec edb bash -c "psql -U hibernate_orm_test -d ${databases[i]} -c \"create extension postgis;\""
344+
done
319345
}
320346

321347
db2() {

hibernate-core/hibernate-core.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ tasks.withType( Test.class ).each { test ->
260260
test.jvmArgs( ['-Dlog4j2.disableJmx=true'] )
261261

262262
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
263-
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" ) {
263+
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci" ) {
264264
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
265265
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
266266
def threadCount = Runtime.runtime.availableProcessors()

hibernate-envers/hibernate-envers.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ configurations {
5656

5757
tasks.withType( Test.class ).each { test ->
5858
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
59-
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" ) {
59+
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci" ) {
6060
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
6161
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
6262
def threadCount = Runtime.runtime.availableProcessors()

local-build-plugins/src/main/groovy/local.databases.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ ext {
9494
'jdbc.user' : 'hibernate_orm_test',
9595
'jdbc.pass' : 'hibernate_orm_test',
9696
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
97-
'jdbc.url' : 'jdbc:edb://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
97+
'jdbc.url' : 'jdbc:edb://' + dbHost + '/hibernate_orm_test_$worker?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
9898
'jdbc.datasource' : 'com.edb.Driver',
9999
// 'jdbc.datasource' : 'com.edb.ds.PGSimpleDataSource',
100100
'connection.init_sql' : ''

0 commit comments

Comments
 (0)