Skip to content
Snippets Groups Projects
Commit 4e767d0f authored by Brett Randall's avatar Brett Randall Committed by Sean Owen
Browse files

[SPARK-15723] Fixed local-timezone-brittle test where short-timezone form "EST" is …

## What changes were proposed in this pull request?

Stop using the abbreviated and ambiguous timezone "EST" in a test, since it is machine-local default timezone dependent, and fails in different timezones.  Fixed [SPARK-15723](https://issues.apache.org/jira/browse/SPARK-15723).

## How was this patch tested?

Note that to reproduce this problem in any locale/timezone, you can modify the scalatest-maven-plugin argLine to add a timezone:

    <argLine>-ea -Xmx3g -XX:MaxPermSize=${MaxPermGen} -XX:ReservedCodeCacheSize=${CodeCacheSize} -Duser.timezone="Australia/Sydney"</argLine>

and run

    $ mvn test -DwildcardSuites=org.apache.spark.status.api.v1.SimpleDateParamSuite -Dtest=none. Equally this will fix it in an effected timezone:

    <argLine>-ea -Xmx3g -XX:MaxPermSize=${MaxPermGen} -XX:ReservedCodeCacheSize=${CodeCacheSize} -Duser.timezone="America/New_York"</argLine>

To test the fix, apply the above change to `pom.xml` to set test TZ to `Australia/Sydney`, and confirm the test now passes.

Author: Brett Randall <javabrett@gmail.com>

Closes #13462 from javabrett/SPARK-15723-SimpleDateParamSuite.
parent 0f307db5
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,8 @@ class SimpleDateParamSuite extends SparkFunSuite with Matchers { ...@@ -26,7 +26,8 @@ class SimpleDateParamSuite extends SparkFunSuite with Matchers {
test("date parsing") { test("date parsing") {
new SimpleDateParam("2015-02-20T23:21:17.190GMT").timestamp should be (1424474477190L) new SimpleDateParam("2015-02-20T23:21:17.190GMT").timestamp should be (1424474477190L)
new SimpleDateParam("2015-02-20T17:21:17.190EST").timestamp should be (1424470877190L) // don't use EST, it is ambiguous, use -0500 instead, see SPARK-15723
new SimpleDateParam("2015-02-20T17:21:17.190-0500").timestamp should be (1424470877190L)
new SimpleDateParam("2015-02-20").timestamp should be (1424390400000L) // GMT new SimpleDateParam("2015-02-20").timestamp should be (1424390400000L) // GMT
intercept[WebApplicationException] { intercept[WebApplicationException] {
new SimpleDateParam("invalid date") new SimpleDateParam("invalid date")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment