Skip to content

Commit 27a9d65

Browse files
committed
HHH-14892 Enable parallel testing for Oracle
1 parent a702350 commit 27a9d65

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

docker_db.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,19 @@ oracle_setup() {
709709
done
710710
sleep 2;
711711
echo "Oracle successfully started"
712+
713+
users=()
714+
for n in $(seq 1 $(($(nproc)/2)))
715+
do
716+
users+=("hibernate_orm_test_${n}")
717+
done
718+
create_cmd=
719+
for i in "${!users[@]}";do
720+
create_cmd+="
721+
create user ${users[i]} identified by hibernate_orm_test quota unlimited on users;
722+
grant all privileges to ${users[i]};"
723+
done
724+
712725
# We increase file sizes to avoid online resizes as that requires lots of CPU which is restricted in XE
713726
$PRIVILEGED_CLI $CONTAINER_CLI exec oracle bash -c "source /home/oracle/.bashrc; bash -c \"
714727
cat <<EOF | \$ORACLE_HOME/bin/sqlplus / as sysdba
@@ -770,6 +783,7 @@ alter tablespace SYSAUX nologging;
770783
771784
create user hibernate_orm_test identified by hibernate_orm_test quota unlimited on users;
772785
grant all privileges to hibernate_orm_test;
786+
${create_cmd}
773787
EOF\""
774788
}
775789

@@ -789,6 +803,19 @@ oracle_free_setup() {
789803
done
790804
sleep 2;
791805
echo "Oracle successfully started"
806+
807+
users=()
808+
for n in $(seq 1 $(($(nproc)/2)))
809+
do
810+
users+=("hibernate_orm_test_${n}")
811+
done
812+
create_cmd=
813+
for i in "${!users[@]}";do
814+
create_cmd+="
815+
create user ${users[i]} identified by hibernate_orm_test quota unlimited on users;
816+
grant all privileges to ${users[i]};"
817+
done
818+
792819
# We increase file sizes to avoid online resizes as that requires lots of CPU which is restricted in XE
793820
$PRIVILEGED_CLI $CONTAINER_CLI exec oracle bash -c "source /home/oracle/.bashrc; bash -c \"
794821
cat <<EOF | \$ORACLE_HOME/bin/sqlplus / as sysdba
@@ -849,6 +876,7 @@ alter tablespace SYSAUX nologging;
849876
850877
create user hibernate_orm_test identified by hibernate_orm_test quota unlimited on users;
851878
grant all privileges to hibernate_orm_test;
879+
${create_cmd}
852880
EOF\""
853881
}
854882

hibernate-core/hibernate-core.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ 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" || project.db == "edb_ci" ) {
263+
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" ) {
264265
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
265266
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
266267
def threadCount = Runtime.runtime.availableProcessors()

hibernate-envers/hibernate-envers.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ 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" || project.db == "edb_ci" ) {
59+
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" ) {
6061
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
6162
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
6263
def threadCount = Runtime.runtime.availableProcessors()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ext {
193193
oracle_ci : [
194194
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
195195
'jdbc.driver': 'oracle.jdbc.OracleDriver',
196-
'jdbc.user' : 'hibernate_orm_test',
196+
'jdbc.user' : 'hibernate_orm_test_$worker',
197197
'jdbc.pass' : 'hibernate_orm_test',
198198
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/freepdb1',
199199
'jdbc.datasource' : 'oracle.jdbc.OracleDriver',
@@ -203,7 +203,7 @@ ext {
203203
oracle_xe_ci : [
204204
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
205205
'jdbc.driver': 'oracle.jdbc.OracleDriver',
206-
'jdbc.user' : 'hibernate_orm_test',
206+
'jdbc.user' : 'hibernate_orm_test_$worker',
207207
'jdbc.pass' : 'hibernate_orm_test',
208208
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xepdb1',
209209
'jdbc.datasource' : 'oracle.jdbc.OracleDriver',

0 commit comments

Comments
 (0)