Skip to content

Commit 25890bb

Browse files
sbt 2.x: run integration tests sequentially to avoid Postgres connection exhaustion
Root cause of the sbt 2.0 test failures: 'FATAL: remaining connection slots are reserved'. Each integration spec opens Hikari pools (users+discussions x connectionPool) against the one shared Postgres; sbt 2.x runs test classes in the forked JVM more concurrently than sbt 1.x, blowing past Postgres's connection limit -> flyway migrate / queries fail with 'ResultSet exhausted'. Set Test/parallelExecution=false + testForkedParallel=false for the integration-test modules (Tags.limit(Test,1) alone only serialized across modules).
1 parent 0318a7e commit 25890bb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

branchtalk.sbt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ val tests = Seq(
131131
) ++ scalafmtConfigSettings(Test)
132132

133133
val integrationTests = tests ++ Seq(
134-
Test / fork := true
134+
Test / fork := true,
135+
// Integration tests each open Hikari pools against the one shared Postgres; sbt 2.x runs test classes in a forked JVM
136+
// more concurrently than sbt 1.x, exhausting Postgres connection slots. Run them sequentially.
137+
Test / parallelExecution := false,
138+
Test / testForkedParallel := false
135139
)
136140

137141
def customPredef(imports: String*): Def.Setting[Task[Seq[String]]] =

0 commit comments

Comments
 (0)