Skip to content

Commit

Permalink
Fix running timezone-sensitive tests in IntelliJ IDEA
Browse files Browse the repository at this point in the history
Some time ago, some properties were moved to `argLine` because Surefire
incorrectly passes the `user.language` and `user.region` system
properties to the tests. At that time, the `user.timezone` also got
along for the ride, but it turns out, that that latter property *is*
passed correctly. So while it works for Maven and Surefire, moving it
into `argLine` causes IntelliJ IDEA to not pick it up, which in turn
means that some tests are not working properly when executed inside the
IDE. We can move it safely back, as it improves quality of life.

This reverts parts of commit d4630aa.
  • Loading branch information
ksobolew authored and findepi committed May 30, 2023
1 parent 345ea79 commit 02901c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Airbase 140

* Pass `user.timezone` in tests as a system property, not as a JVM argument
- It restores the ability to run some timezone-sensitive tests
from within IntelliJ IDEA

Airbase 139

* Replace checkstyle illegal imports with `RestrictImports` enforcer rules
Expand Down
5 changes: 2 additions & 3 deletions airbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@
<configuration>
<systemPropertyVariables>
<sun.jnu.encoding>${project.build.sourceEncoding}</sun.jnu.encoding>
<user.timezone>${air.test.timezone}</user.timezone>
<java.awt.headless>true</java.awt.headless>
<java.util.logging.SimpleFormatter.format>%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tS.%1$tL%1$tz %4$s %5$s%6$s%n</java.util.logging.SimpleFormatter.format>
</systemPropertyVariables>
Expand All @@ -510,9 +511,7 @@
<argLine>
@{argLine}

<!-- Pass the following three directly to the JVM,
because systemPropertyVariables are not passed correctly by Maven -->
-Duser.timezone=${air.test.timezone}
<!-- Pass the following properties directly to the JVM, because they are not passed correctly by Surefire: -->
-Duser.language=${air.test.language}
-Duser.region=${air.test.region}

Expand Down

0 comments on commit 02901c1

Please sign in to comment.