beyond-all-reason / teiserver

Middleware server for online gaming
https://www.beyondallreason.info/
MIT License
61 stars 53 forks source link

set timezone on timezone-unaware test #524

Closed NortySpock closed 1 week ago

NortySpock commented 1 week ago

This test was failing on my machine with the following (but did not fail in the GH Action build):

code:  assert TimexHelper.date_to_str(@today) == "2013-12-04"
     left:  "2013-12-03"
     right: "2013-12-04"

Some brief investigation showed that the time calculation was 6 hours prior; which lines up with my current timezone, America/Chicago, or UTC -6:00.

code:  assert TimexHelper.date_to_str(@today, format: :ymd_hms) == "2013-12-04"
     left:  "2013-12-03 18:00:00"
     right: "2013-12-04"

Setting the timezone on the test to the same timezone specified when the initial time set up fixed the test failure. I think it would fix the test failure for all developers west of the selected timezone of Europe/London.

(Alternative option: if there was a way to set the timezone for the container doing the testing, this would also become a host-timezone-independent test.)