Skip to content

Commit cdc4f5b

Browse files
committed
Pin forked test JVMs to UTC
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.
1 parent cb43857 commit cdc4f5b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

build.sbt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ lazy val nativeSettings = Seq(
171171
)
172172
)
173173

174+
// Pin the forked test JVM to UTC: mssql-jdbc binds a zone-naive java.sql.Timestamp using the
175+
// ambient JVM zone, so MSSQL datetime tests fail off-UTC unless pinned. Only meaningful where
176+
// Test / fork := true.
177+
lazy val utcTestSettings = Seq(
178+
Test / javaOptions += "-Duser.timezone=UTC"
179+
)
180+
174181
lazy val modules: List[CompositeProject] = List(
175182
core,
176183
circe,
@@ -272,6 +279,7 @@ lazy val doobiecore = project
272279
.disablePlugins(RevolverPlugin)
273280
.dependsOn(sqlcore.jvm % "test->test;compile->compile", circe.jvm)
274281
.settings(commonSettings)
282+
.settings(utcTestSettings)
275283
.settings(
276284
name := "grackle-doobie-core",
277285
Test / fork := true,
@@ -291,6 +299,7 @@ lazy val doobiepg = project
291299
doobiecore % "test->test;compile->compile",
292300
sqlpg.jvm % "test->test;compile->compile")
293301
.settings(commonSettings)
302+
.settings(utcTestSettings)
294303
.settings(
295304
name := "grackle-doobie-pg",
296305
Test / fork := true,
@@ -310,6 +319,7 @@ lazy val doobieoracle = project
310319
.disablePlugins(RevolverPlugin)
311320
.dependsOn(doobiecore % "test->test;compile->compile")
312321
.settings(commonSettings)
322+
.settings(utcTestSettings)
313323
.settings(
314324
name := "grackle-doobie-oracle",
315325
Test / fork := true,
@@ -327,6 +337,7 @@ lazy val doobiemssql = project
327337
.disablePlugins(RevolverPlugin)
328338
.dependsOn(doobiecore % "test->test;compile->compile")
329339
.settings(commonSettings)
340+
.settings(utcTestSettings)
330341
.settings(
331342
name := "grackle-doobie-mssql",
332343
Test / fork := true,
@@ -354,6 +365,7 @@ lazy val skunk = crossProject(JVMPlatform, JSPlatform, NativePlatform)
354365
"org.typelevel" %% "log4cats-core" % log4catsVersion
355366
)
356367
)
368+
.jvmSettings(utcTestSettings)
357369
.jvmSettings(
358370
Test / fork := true,
359371
Test / testOptions += Tests.Setup(_ =>

0 commit comments

Comments
 (0)