Skip to content

Commit 47f418b

Browse files
committed
Make ORM 5 compatibility test work on machines with different timezones
Since ZoneOffsetDateTime serialization/deserialization in Hibernate ORM 5 gives different results based on the default JVM timezone, it is very important that we use the same TZ when generating data (which happened on my local machine) and running tests (which happens on CI). Here I'm forcing the default TZ when generating data too, so that other people can re-generate data even if their timezone is different.
1 parent 1e6b33b commit 47f418b

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

build-parent/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
<enforce-test-deps-scope.skip>${enforcer.skip}</enforce-test-deps-scope.skip>
171171

172172
<surefire.argLine.additional></surefire.argLine.additional>
173+
<failsafe.argLine.additional>${surefire.argLine.additional}</failsafe.argLine.additional>
173174
<os-maven-plugin.version>1.7.0</os-maven-plugin.version>
174175

175176
<!-- google cloud functions invoker-->
@@ -460,7 +461,7 @@
460461
<project.groupId>${project.groupId}</project.groupId>
461462
</systemPropertyVariables>
462463
<!-- set tmpdir as early as possible because failsafe sets it too late for JDK16 -->
463-
<argLine>-Djava.io.tmpdir="${project.build.directory}"</argLine>
464+
<argLine>-Djava.io.tmpdir="${project.build.directory}" ${failsafe.argLine.additional}</argLine>
464465
<excludedEnvironmentVariables>MAVEN_OPTS</excludedEnvironmentVariables>
465466
</configuration>
466467
</plugin>

integration-tests/hibernate-orm-compatibility-5.6/mariadb/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
<properties>
1717
<mariadb.url>jdbc:mariadb://localhost:3306/hibernate_orm_test</mariadb.url>
18+
<!-- We test features in Hibernate ORM that are timezone-sensitive, e.g. ZoneOffsetDateTime normalization -->
19+
<surefire.argLine.additional>-Duser.timezone=Europe/Paris</surefire.argLine.additional>
1820
</properties>
1921

2022
<dependencies>

integration-tests/hibernate-orm-compatibility-5.6/mariadb/update-dump.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ trap '$MVN docker:stop -Dstart-containers -Ddocker.containerNamePattern=$DB_CONT
1515

1616
# Generate database
1717
$MVN -f ../database-generator clean install -Ddb-kind=mariadb
18+
# We use features in Hibernate ORM that are timezone-sensitive, e.g. ZoneOffsetDateTime normalization
19+
TZ=Europe/Paris
1820
QUARKUS_DATASOURCE_JDBC_URL="jdbc:mariadb://localhost:$DB_PORT/$DB_NAME" \
1921
QUARKUS_DATASOURCE_USERNAME="$DB_USER" \
2022
QUARKUS_DATASOURCE_PASSWORD="$DB_PASSWORD" \

integration-tests/hibernate-orm-compatibility-5.6/postgresql/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<artifactId>quarkus-integration-test-hibernate-orm-compatibility-5.6-postgresql</artifactId>
1414
<name>Quarkus - Integration Tests - Hibernate ORM - Compatibility with databases meant for ORM 5.6 - PostgreSQL</name>
1515

16+
<properties>
17+
<!-- We test features in Hibernate ORM that are timezone-sensitive, e.g. ZoneOffsetDateTime normalization -->
18+
<surefire.argLine.additional>-Duser.timezone=Europe/Paris</surefire.argLine.additional>
19+
</properties>
20+
1621
<dependencies>
1722
<dependency>
1823
<groupId>io.quarkus</groupId>

integration-tests/hibernate-orm-compatibility-5.6/postgresql/update-dump.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ trap '$MVN docker:stop -Dstart-containers -Ddocker.containerNamePattern=$DB_CONT
1515

1616
# Generate database
1717
$MVN -f ../database-generator clean install -Ddb-kind=postgresql
18+
# We use features in Hibernate ORM that are timezone-sensitive, e.g. ZoneOffsetDateTime normalization
19+
TZ=Europe/Paris
1820
QUARKUS_DATASOURCE_JDBC_URL="jdbc:postgresql://localhost:$DB_PORT/$DB_NAME" \
1921
QUARKUS_DATASOURCE_USERNAME="$DB_USER" \
2022
QUARKUS_DATASOURCE_PASSWORD="$DB_PASSWORD" \

0 commit comments

Comments
 (0)