Skip to content

Commit

Permalink
Fix #4988. Handle Maven Surefire locale and timezone manually via pro…
Browse files Browse the repository at this point in the history
…perties, so users around the globe all use the same and tests don't fail.
  • Loading branch information
poikilotherm committed Sep 17, 2018
1 parent 2d2fac8 commit 381eea3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions conf/docker-aio/1prep.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

export LANG="en_US.UTF-8"

# move things necessary for integration tests into build context.
# this was based off the phoenix deployment; and is likely uglier and bulkier than necessary in a perfect world

Expand Down
4 changes: 4 additions & 0 deletions doc/sphinx-guides/source/developers/dev-environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Launch Netbeans and click "File" and then "Open Project". Navigate to where you

If you installed Maven instead of Netbeans, run ``mvn package``.

NOTE: Do you use a locale different than ``en_US.UTF-8`` and a timezone different to ``UTC`` on your development machine?
You might experience issues while running tests that were written with these settings in mind. The Maven ``pom.xml``
tries to handle this for you, but more, not yet discovered building or testing problems might lurk in the shadows.

Install jq
~~~~~~~~~~

Expand Down
3 changes: 3 additions & 0 deletions doc/sphinx-guides/source/developers/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ We are aware that there are newer testing tools such as TestNG, but we use `JUni

If writing tests is new to you, poke around existing unit tests which all end in ``Test.java`` and live under ``src/test``. Each test is annotated with ``@Test`` and should have at least one assertion which specifies the expected result. In Netbeans, you can run all the tests in it by clicking "Run" -> "Test File". From the test file, you should be able to navigate to the code that's being tested by right-clicking on the file and clicking "Navigate" -> "Go to Test/Tested class". Likewise, from the code, you should be able to use the same "Navigate" menu to go to the tests.

NOTE: Please remember when writing tests checking possibly localized outputs to check against ``en_US.UTF-8`` and ``UTC``
l10n strings!

Refactoring Code to Make It Unit-Testable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<additionalparam>-Xdoclint:none</additionalparam>
<aws.version>1.11.172</aws.version>
<project.timezone>UTC</project.timezone>
<project.language>en</project.language>
<project.region>US</project.region>
</properties>

<repositories>
Expand Down Expand Up @@ -635,6 +638,7 @@
<configuration>
<!-- testsToExclude come from the profile-->
<excludedGroups>${testsToExclude}</excludedGroups>
<argLine>-Duser.timezone=${project.timezone} -Dfile.encoding=${project.build.sourceEncoding} -Duser.language=${project.language} -Duser.region=${project.region}</argLine>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit 381eea3

Please sign in to comment.