From d7ce2e6dca18f565945ee4d3837cf8fb860a2939 Mon Sep 17 00:00:00 2001 From: phdoerfler Date: Sun, 12 Jul 2026 18:20:26 +0200 Subject: [PATCH] Raise munit timeout for database-backed test suites munit-cats-effect's 30s default is not enough headroom for the database-backed suites on a constrained machine: sbt runs each backend's tests in its own forked JVM, several of which contend for one docker daemon, and under that load individual tests have been observed to exceed 30s and fail with spurious TimeoutExceptions unrelated to what they test. Introduce a shared SqlDatabaseSuite base trait in sql-core's test scope, extended by DoobieDatabaseSuite and SqlPgDatabaseSuite (a single base rather than per-trait overrides, since DoobiePgDatabaseSuite mixes in both and separate overrides of munitIOTimeout would conflict), raising the timeout to 2 minutes for every backend suite. --- .../src/test/scala/DoobieDatabaseSuite.scala | 3 +- .../src/test/scala/SqlDatabaseSuite.scala | 30 +++++++++++++++++++ .../src/test/scala/SqlPgDatabaseSuite.scala | 4 +-- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 modules/sql-core/src/test/scala/SqlDatabaseSuite.scala diff --git a/modules/doobie-core/src/test/scala/DoobieDatabaseSuite.scala b/modules/doobie-core/src/test/scala/DoobieDatabaseSuite.scala index 44bde653..a92d8c5e 100644 --- a/modules/doobie-core/src/test/scala/DoobieDatabaseSuite.scala +++ b/modules/doobie-core/src/test/scala/DoobieDatabaseSuite.scala @@ -18,13 +18,12 @@ package grackle.doobie.test import java.time.Duration import io.circe.{Decoder => CDecoder, Encoder => CEncoder} -import munit.CatsEffectSuite import org.typelevel.doobie.Meta import grackle.doobie.DoobieMappingLike import grackle.sql.test._ -trait DoobieDatabaseSuite extends CatsEffectSuite { +trait DoobieDatabaseSuite extends SqlDatabaseSuite { trait DoobieTestMapping[F[_]] extends DoobieMappingLike[F] with SqlTestMapping[F] { type TestCodec[T] = (Meta[T], Boolean) diff --git a/modules/sql-core/src/test/scala/SqlDatabaseSuite.scala b/modules/sql-core/src/test/scala/SqlDatabaseSuite.scala new file mode 100644 index 00000000..6dcecbd3 --- /dev/null +++ b/modules/sql-core/src/test/scala/SqlDatabaseSuite.scala @@ -0,0 +1,30 @@ +// Copyright (c) 2016-2025 Association of Universities for Research in Astronomy, Inc. (AURA) +// Copyright (c) 2016-2025 Grackle Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grackle.sql.test + +import scala.concurrent.duration._ + +import munit.CatsEffectSuite + +/** + * Common base for the per-backend database suite traits, raising munit-cats-effect's 30s + * default timeout: database-backed tests can exceed it for reasons that have nothing to do with + * the test itself, e.g. several forked backend test JVMs contending for one docker daemon on a + * constrained machine, showing up as spurious timeouts rather than failures. + */ +trait SqlDatabaseSuite extends CatsEffectSuite { + override def munitIOTimeout: Duration = 2.minutes +} diff --git a/modules/sql-pg/js-jvm/src/test/scala/SqlPgDatabaseSuite.scala b/modules/sql-pg/js-jvm/src/test/scala/SqlPgDatabaseSuite.scala index a1c4965d..0650becc 100644 --- a/modules/sql-pg/js-jvm/src/test/scala/SqlPgDatabaseSuite.scala +++ b/modules/sql-pg/js-jvm/src/test/scala/SqlPgDatabaseSuite.scala @@ -15,9 +15,9 @@ package grackle.sqlpg.test -import munit.CatsEffectSuite +import grackle.sql.test.SqlDatabaseSuite -trait SqlPgDatabaseSuite extends CatsEffectSuite { +trait SqlPgDatabaseSuite extends SqlDatabaseSuite { case class PostgresConnectionInfo(host: String, port: Int) { val driverClassName = "org.postgresql.Driver"