-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
With Quarkus 3.22.x and the new test classloading rewrite (see blog post), QuarkusTest now starts a separate instance of each required dev service for every test profile at startup. This happens regardless of which tests are actually selected to run (e.g., via test tags or filters). As a result, all dev services for all profiles are started up front, even if only a subset of tests will execute. This can quickly exhaust resources on CI servers, especially when multiple heavy dev services (e.g., LocalStack) are involved.
Expected behavior
Only the dev services required for the tests that will actually be executed should be started. If test selection (e.g., by tag or class) means some profiles/tests will not run, their dev services should not be started. There should be a way to toggle between the new and previous behavior to optimize for CI resource usage.
Actual behavior
All dev services for all test profiles are started at the beginning of the test run, regardless of which tests are actually selected to run. This leads to unnecessary resource consumption and potential port conflicts, even if only a single test is executed.
Example output from docker ps -a
(showing multiple LocalStack and Ryuk containers started for different profiles):
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cfb993acd253 localstack/localstack:4.2.0 "sh -c 'while [ ! -f…" 1 second ago Up 1 second (health: starting) 4510-4559/tcp, 5678/tcp, 0.0.0.0:60644->4566/tcp practical_vaughan
ae8051b47af5 testcontainers/ryuk:0.11.0 "/bin/ryuk" 2 seconds ago Up 2 seconds 0.0.0.0:60630->8080/tcp testcontainers-ryuk-3a968fbf-f9c8-4d59-a50d-530524dfd396
e1e06af6ddef localstack/localstack:4.2.0 "sh -c 'while [ ! -f…" 11 seconds ago Up 11 seconds (healthy) 4510-4559/tcp, 5678/tcp, 0.0.0.0:60550->4566/tcp distracted_vaughan
b24635eecb86 testcontainers/ryuk:0.11.0 "/bin/ryuk" 12 seconds ago Up 12 seconds 0.0.0.0:60540->8080/tcp testcontainers-ryuk-455b5c1f-4138-4d1d-8afa-a8186510aa32
cd8c80fa2a1c localstack/localstack:4.2.0 "sh -c 'while [ ! -f…" 22 seconds ago Up 22 seconds (healthy) 4510-4559/tcp, 5678/tcp, 0.0.0.0:60457->4566/tcp relaxed_hoover
eb11dab071b0 testcontainers/ryuk:0.11.0 "/bin/ryuk" 23 seconds ago Up 23 seconds 0.0.0.0:60449->8080/tcp testcontainers-ryuk-302e8408-7dbb-4669-8abf-cfd982c86232
167b83a3c4b1 postgres:17 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:56484->5432/tcp charming_robinson
How to Reproduce?
- Create a Quarkus project with multiple test profiles, each requiring a different dev service (e.g., LocalStack, Postgres).
- Annotate test classes with
@QuarkusTest
and@TestProfile(...)
for each profile. - Run tests with a filter (e.g., by tag or class) so that only a subset of tests should execute. (
./mvnw clean compile test -Dgroups=test1
- Observe that all dev services for all profiles are started at the beginning of the test run, regardless of which tests are actually executed.
See
Output of uname -a
or ver
Darwin MacBook-Pro-2.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6030 arm64
Output of java -version
openjdk version "21.0.4" 2024-07-16 LTS OpenJDK Runtime Environment Corretto-21.0.4.7.1 (build 21.0.4+7-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.4.7.1 (build 21.0.4+7-LTS, mixed mode, sharing)
Quarkus version or git rev
3.22.2
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: /Users/charlesjiang/.m2/wrapper/dists/apache-maven-3.9.9-bin/33b4b2b4/apache-maven-3.9.9 Java version: 21.0.4, vendor: Amazon.com Inc., runtime: /Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home Default locale: en_NZ, platform encoding: UTF-8 OS name: "mac os x", version: "15.4.1", arch: "x86_64", family: "mac"
Additional information
- This behavior can cause CI jobs to fail due to resource exhaustion.
- There is currently no way to revert to the previous behavior or to defer dev service startup until it is known which tests will run.
- A toggle or smarter dev service startup logic would help optimize resource usage, especially in CI environments.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status