From c67403e01fd84da724135b61715b95a0851f6c3a Mon Sep 17 00:00:00 2001 From: LLEFEVRE Date: Fri, 30 Jun 2023 15:18:16 +0200 Subject: [PATCH] HHH-16876 Update Oracle testing to 23c --- README.adoc | 2 +- ci/build.sh | 3 + docker_db.sh | 96 ++++++++++++++++++- gradle/databases.gradle | 8 ++ .../orm/test/filter/FilterParameterTests.java | 1 + ...tityValuedInSubqueryGroupAndOrderTest.java | 4 + hibernate-spatial/hibernate-spatial.gradle | 1 + 7 files changed, 113 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index d5d5922f5d..1c76b00620 100644 --- a/README.adoc +++ b/README.adoc @@ -177,7 +177,7 @@ The following table illustrates a list of commands for various databases that ca |Oracle XE |`./docker_db.sh oracle` -|`./gradlew test -Pdb=oracle_ci` +|`./gradlew test -Pdb=oracle_free_ci` |DB2 |`./docker_db.sh db2` diff --git a/ci/build.sh b/ci/build.sh index 7642d4ec17..03463226ce 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -18,6 +18,9 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_11" ]; then goal="-Pdb=edb_ci -DdbHost=localhost:5444" elif [ "$RDBMS" == "oracle" ]; then goal="-Pdb=oracle_ci" +elif [ "$RDBMS" == "oracle_xe" ]; then + # I have no idea why, but these tests don't seem to work on CI... + goal="-Pdb=oracle_xe_ci" elif [ "$RDBMS" == "oracle_atps" ]; then echo "Managing Oracle Autonomous Database..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=autonomous&hostname=`hostname`" -H 'accept: application/json') diff --git a/docker_db.sh b/docker_db.sh index 243d1c8a4d..aa51ef4c94 100755 --- a/docker_db.sh +++ b/docker_db.sh @@ -561,6 +561,85 @@ grant all privileges to hibernate_orm_test; EOF\"" } +oracle_free_setup() { + HEALTHSTATUS= + until [ "$HEALTHSTATUS" == "healthy" ]; + do + echo "Waiting for Oracle Free to start..." + sleep 5; + # On WSL, health-checks intervals don't work for Podman, so run them manually + if command -v podman > /dev/null; then + $PRIVILEGED_CLI $CONTAINER_CLI healthcheck run oracle > /dev/null + fi + HEALTHSTATUS="`$PRIVILEGED_CLI $CONTAINER_CLI inspect -f $HEALTCHECK_PATH oracle`" + HEALTHSTATUS=${HEALTHSTATUS##+( )} #Remove longest matching series of spaces from the front + HEALTHSTATUS=${HEALTHSTATUS%%+( )} #Remove longest matching series of spaces from the back + done + sleep 2; + echo "Oracle successfully started" + # We increase file sizes to avoid online resizes as that requires lots of CPU which is restricted in XE + $PRIVILEGED_CLI $CONTAINER_CLI exec oracle bash -c "source /home/oracle/.bashrc; bash -c \" +cat < /opt/oracle/oradata/dbconfig/FREE/sqlnet.ora +!lsnrctl reload +-- Increasing redo logs +alter database add logfile group 4 '\$ORACLE_BASE/oradata/FREE/redo04.log' size 500M reuse; +alter database add logfile group 5 '\$ORACLE_BASE/oradata/FREE/redo05.log' size 500M reuse; +alter database add logfile group 6 '\$ORACLE_BASE/oradata/FREE/redo06.log' size 500M reuse; +alter system switch logfile; +alter system switch logfile; +alter system switch logfile; +alter system checkpoint; +alter database drop logfile group 1; +alter database drop logfile group 2; +alter database drop logfile group 3; +!rm \$ORACLE_BASE/oradata/FREE/redo01.log +!rm \$ORACLE_BASE/oradata/FREE/redo02.log +!rm \$ORACLE_BASE/oradata/FREE/redo03.log + +-- Increasing SYSAUX data file +alter database datafile '\$ORACLE_BASE/oradata/FREE/sysaux01.dbf' resize 600M; + +-- Modifying database init parameters +alter system set open_cursors=1000 sid='*' scope=both; +alter system set session_cached_cursors=500 sid='*' scope=spfile; +alter system set db_securefile=ALWAYS sid='*' scope=spfile; +alter system set dispatchers='(PROTOCOL=TCP)(SERVICE=FREEXDB)(DISPATCHERS=0)' sid='*' scope=spfile; +alter system set recyclebin=OFF sid='*' SCOPE=SPFILE; + +-- Comment the 2 next lines to be able to use Diagnostics Pack features +alter system set sga_target=0m sid='*' scope=both; +-- alter system set statistics_level=BASIC sid='*' scope=spfile; + +-- Restart the database +SHUTDOWN IMMEDIATE; +STARTUP MOUNT; +ALTER DATABASE OPEN; + +-- Switch to the FREEPDB1 pluggable database +alter session set container=freepdb1; + +-- Modify FREEPDB1 datafiles and tablespaces +alter database datafile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/system01.dbf' resize 320M; +alter database datafile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/sysaux01.dbf' resize 360M; +alter database datafile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/undotbs01.dbf' resize 400M; +alter database datafile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/undotbs01.dbf' autoextend on next 16M; +alter database tempfile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/temp01.dbf' resize 400M; +alter database tempfile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/temp01.dbf' autoextend on next 16M; +alter database datafile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/users01.dbf' resize 100M; +alter database datafile '\$ORACLE_BASE/oradata/FREE/FREEPDB1/users01.dbf' autoextend on next 16M; +alter tablespace USERS nologging; +alter tablespace SYSTEM nologging; +alter tablespace SYSAUX nologging; + +create user hibernate_orm_test identified by hibernate_orm_test quota unlimited on users; +grant all privileges to hibernate_orm_test; +EOF\"" +} + oracle_setup_old() { HEALTHSTATUS= until [ "$HEALTHSTATUS" == "healthy" ]; @@ -695,7 +774,7 @@ EOF } oracle() { - oracle_21 + oracle_23 } oracle_11() { @@ -726,6 +805,20 @@ oracle_21() { oracle_setup } +oracle_23() { + $PRIVILEGED_CLI $CONTAINER_CLI rm -f oracle || true + disable_userland_proxy + # We need to use the defaults + # SYSTEM/Oracle18 + $PRIVILEGED_CLI $CONTAINER_CLI run --name oracle -d -p 1521:1521 -e ORACLE_PASSWORD=Oracle18 \ + --health-cmd healthcheck.sh \ + --health-interval 5s \ + --health-timeout 5s \ + --health-retries 10 \ + docker.io/gvenzl/oracle-free:23-full + oracle_free_setup +} + hana() { temp_dir=$(mktemp -d) echo '{"master_password" : "H1bernate_test"}' >$temp_dir/password.json @@ -979,6 +1072,7 @@ if [ -z ${1} ]; then echo -e "\tmysql_8_0" echo -e "\tmysql_5_7" echo -e "\toracle" + echo -e "\toracle_23" echo -e "\toracle_21" echo -e "\toracle_11" echo -e "\tpostgresql" diff --git a/gradle/databases.gradle b/gradle/databases.gradle index 6e0f0d11e6..65f0123548 100644 --- a/gradle/databases.gradle +++ b/gradle/databases.gradle @@ -141,6 +141,14 @@ ext { 'connection.init_sql' : '' ], oracle_ci : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/freepdb1', + 'connection.init_sql' : '' + ], + oracle_xe_ci : [ 'db.dialect' : 'org.hibernate.dialect.OracleDialect', 'jdbc.driver': 'oracle.jdbc.OracleDriver', 'jdbc.user' : 'hibernate_orm_test', diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/FilterParameterTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/FilterParameterTests.java index e3542e3e5a..fde20f490d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/FilterParameterTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/FilterParameterTests.java @@ -87,6 +87,7 @@ public class FilterParameterTests { @SkipForDialect(dialectClass = CockroachDialect.class, matchSubTypes = true, reason = "Cockroach silently converts a boolean to string types") @SkipForDialect(dialectClass = PostgresPlusDialect.class, reason = "PostgresPlus silently converts a boolean to string types") @SkipForDialect(dialectClass = FirebirdDialect.class, reason = "Firebird silently converts a boolean to string") + @SkipForDialect(dialectClass = OracleDialect.class, majorVersion = 23, reason = "Oracle 23 interprets Y and T as true and N and F as false, so this works") public void testYesNoMismatch(SessionFactoryScope scope) { scope.inTransaction( (session) -> { final EntityOne loaded = session.byId( EntityOne.class ).load( 1 ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/EntityValuedInSubqueryGroupAndOrderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/EntityValuedInSubqueryGroupAndOrderTest.java index d51d2b57ac..399668377e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/EntityValuedInSubqueryGroupAndOrderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/EntityValuedInSubqueryGroupAndOrderTest.java @@ -6,10 +6,13 @@ */ package org.hibernate.orm.test.query; +import org.hibernate.dialect.OracleDialect; + import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.hibernate.testing.orm.junit.SkipForDialect; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -51,6 +54,7 @@ public class EntityValuedInSubqueryGroupAndOrderTest { } @Test + @SkipForDialect(dialectClass = OracleDialect.class, majorVersion = 23, reason = "Oracle 23c bug") public void testInSubqueryGroupBy(SessionFactoryScope scope) { scope.inTransaction( session -> { final EntityB result = session.createQuery( diff --git a/hibernate-spatial/hibernate-spatial.gradle b/hibernate-spatial/hibernate-spatial.gradle index c68f0c89d2..34ba99f164 100644 --- a/hibernate-spatial/hibernate-spatial.gradle +++ b/hibernate-spatial/hibernate-spatial.gradle @@ -50,6 +50,7 @@ tasks.test { 'mysql_ci', 'oracle', 'oracle_ci', + 'oracle_xe_ci', 'mssql', 'mssql_ci' ].contains( project.db )