Failing tests - Timezone related?
Closed this issue · 4 comments
The tests relying on parsing dates (Ex: "June 6, 2020 11:01"
) fail because of a 2 hours difference between the expected and actual values.
- codax.example-test/messaging-example
- codax.example-test/bulk
I suspect this is because the parsed time is assumed to be in the local timezone, but the expected value is in UTC.
A possible alternative would be to leverage the #inst
tag.
Seconds, milliseconds and the timezone can be omitted to reduce the visual noise:
#inst "2023-08-12T01:00"
; => #inst "2023-08-12T01:00:00.000-00:00"
The conversion to Instant is also pretty straightforward:
(.toInstant #inst "2023-08-12T01:00")
;=> #object[java.time.Instant 0x60208ef "2023-08-12T01:00:00Z"]
Before:
(simulate-message! "June 6, 2020 11:01" "Bobby" "Hello")
After:
(simulate-message! #inst "2020-06-06T11:01" "Bobby" "Hello")
That makes sense, but I am not able to reproduce the issue on my end. What is your environment? I am running leiningen 2.9.5 with OpenJDK 11.0.20.
In any case it's still probably a worthwhile cleanup, but a low priority for now.
I'm on Leiningen 2.10.0 on Java 17.0.8 OpenJDK 64-Bit Server VM
.
OS is Ubuntu 22.04.3 LTS
.
Apologies, I somehow closed the issue (?!)
Anyhow, given that this is a simple refactoring of tests, I'll try to do a PR in the next few days.
Would you be open to adding java.util.Date
as a supported path type? It would simplify the current examples, but also allow users to use #inst
directly. Given it's pretty much built-in with Clojure, I think it's even more desirable than Joda-Time
.