Pin forked test JVMs to UTC - #862
Conversation
72e1a4c to
cdc4f5b
Compare
Datetime tests in the MSSQL suite (MovieSuite's `moviesShownBetween` and computed-field cases) fail on a developer machine in a non-UTC time zone, though they pass in CI. The MSSQL test codec encodes an OffsetDateTime argument via a zone-naive `java.sql.Timestamp`, and mssql-jdbc binds it into a DATETIMEOFFSET parameter using the ambient JVM time zone. On a UTC+2 host the filter bound shifts by two hours, admitting an extra row. Postgres is immune (native `Meta[OffsetDateTime]`); Oracle uses the same codec but ojdbc binds it without the shift; CI runs in UTC so it never surfaces there.
cdc4f5b to
ec2106c
Compare
milessabin
left a comment
There was a problem hiding this comment.
I'm not sure I fully understand the issue here. I'm not seeing a problem with the mssql tests when I run them locally in UTC+1.
|
I think if the issue is mssql-specific I would prefer the fix to be as well. I'm neutral on whether that should be in the build or in the test code. |
The IssueThe issue surfaces only with a timezone of UTC+2 or greater (Or UTC+1.75 I suppose). UTC+1 is not enough of a difference to trigger it because of the test data: As a result, 3 of the 14 tests of MovieSuite fail (all three The "Fix"I did add the fix (= It all boils down to: uniform test environment and potentially hiding future traps like this (for better or worse) or risking a potentially different test environment between all backends which might expose additional limitations. For now, I'll drop the system property from the other backend tests. I, too, am neutral on whether it should be in the build or the tests itself. Ultimately, it was easier to just set the property in the build so that's why it's there. Hope this cleared things up! |
Postgres and Oracle aren't affected by the zone-naive Timestamp binding this works around (Postgres uses a native OffsetDateTime codec; Oracle's driver doesn't shift), so pinning their forked test JVMs to UTC was unnecessary. Restrict the setting to doobiemssql, per review feedback, and inline it now that it has a single call site.
Datetime tests in the MSSQL suite (MovieSuite's
moviesShownBetweenand computed-field cases) fail on a developer machine in a non-UTC time zone, while passing in CI. The MSSQL test codec encodes an OffsetDateTime argument via a zone-naivejava.sql.Timestamp(Timestamp.from(o.toInstant)), and mssql-jdbc derives the wall-clock value it binds into a DATETIMEOFFSET parameter using the ambient JVM time zone. On a UTC+2 host the filter bound shifts by two hours, admitting an extra row. Postgres is immune (nativeMeta[OffsetDateTime]); Oracle uses the same Timestamp codec but ojdbc binds it without the shift; CI runs in UTC so it never surfaces there.It might be a better idea to fix this not via the build but through changing the code but I wanted to keep the mssql backend similar to the oracle backend which does not have this issue.