Hello everyone, I’m trying to run my Ktor integration tests in parallel. They make use of Postgres running via testcontainers. To increase efficiency, my base test generates a new database (CREATE DATABASE …) with a randomized name, such that I can use a single docker container for all my integration tests.
When using gradle parallelism (maxParallelForks > 1), it works (these spawn multiple JVM processes if I understood that correctly).
But when using JUnit parallelism (
junit.jupiter.execution.parallel.enabled=true
+ `junit.jupiter.execution.parallel.mode.default=concurrent`; running in multiple threads), the tests affect each other: Even though each test has its own database, somehow they sometimes “see” another tests database. Is it possible that starting multiple
testApplication { … }
in the same JVM, that somehow they affect each other (for example, possibly sharing/overriding config values)? I don’t have any global variables, everything “global” is assigned to application.attributes (using
Attributes(concurrent = true)
).