Skip to content

Commit 7016f92

Browse files
committed
HHH-14892 Enable parallel testing for DB2
1 parent ecafe45 commit 7016f92

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

docker_db.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ EOF
443443
OUTPUT=$($CONTAINER_CLI logs db2 2>&1)
444444
done
445445
$CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
446+
db2_setup
446447
}
447448

448449
db2_12_1() {
@@ -488,6 +489,19 @@ EOF
488489
OUTPUT=$($CONTAINER_CLI logs db2 2>&1)
489490
done
490491
$CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
492+
db2_setup
493+
}
494+
495+
db2_setup() {
496+
pids=()
497+
for n in $(seq 1 $(($(nproc)/2)))
498+
do
499+
$CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile; /database/config/orm_test/sqllib/bin/db2 'connect to orm_test'; /database/config/orm_test/sqllib/bin/db2 'create tenant ORM_${n}';" &
500+
pids[${i}]=$!
501+
done
502+
for pid in ${pids[*]}; do
503+
wait $pid
504+
done
491505
}
492506

493507
db2_spatial() {

hibernate-core/hibernate-core.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ tasks.withType( Test.class ).each { test ->
261261

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

hibernate-envers/hibernate-envers.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ configurations {
5757
tasks.withType( Test.class ).each { test ->
5858
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
5959
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci"
60-
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci" ) {
60+
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci"
61+
|| project.db == "db2_ci") {
6162
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
6263
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
6364
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
@@ -334,7 +334,7 @@ ext {
334334
'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver',
335335
'jdbc.user' : 'orm_test',
336336
'jdbc.pass' : 'orm_test',
337-
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test',
337+
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test:specialRegisters=TENANT=\'ORM_$worker\';',
338338
'jdbc.datasource' : 'com.ibm.db2.jcc.DB2Driver',
339339
// 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2SimpleDataSource',
340340
'connection.init_sql' : ''

0 commit comments

Comments
 (0)