-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QuarkusTest TestProfile pollutes environment of QuarkusComponentTest #46035
Comments
/cc @geoand (kotlin) |
I believe this issue got incorrectly labeled with |
@ryandens couldn't agree more with your analysis. I think we should run the That being said Could you check why it wasn't called? Or why it didn't do its job? |
👍 interesting, I was able to debug this with
It's been a while since I've been in the weeds of JUnit Extension state management. I can't remember the guarantees with the extension state getting closed by JUnit - anecdotally, I recall managing state that must be closed after a test class is complete by |
Yeah so my guess is that the application is not closed when Quarkus switches to component testing. Thus causing the issue. IIRC, the previous app is stopped when the next test starts. I wonder if we should just change
@geoand WDYT? |
I think that's a good idea |
I'll prepare something along these lines. |
I was hoping to constrain JUnit tests and @QuarkusComponentTests but @QuarkusComponentTest is in another artifact so this will have to do. Related to quarkusio#46035. Note that you can still break things if you specify another priority but that's how it is :).
#46046 might help, we will see what CI has to say. Feel free to test it if you can :). |
I was hoping to constrain JUnit tests and @QuarkusComponentTests but @QuarkusComponentTest is in another artifact so this will have to do. Related to quarkusio#46035. Note that you can still break things if you specify another priority but that's how it is :).
I was hoping to constrain JUnit tests and @QuarkusComponentTests but @QuarkusComponentTest is in another artifact so this will have to do. Related to quarkusio#46035. Note that you can still break things if you specify another priority but that's how it is :).
I was hoping to constrain JUnit tests and @QuarkusComponentTests but @QuarkusComponentTest is in another artifact so this will have to do. Related to quarkusio#46035. Note that you can still break things if you specify another priority but that's how it is :).
I was hoping to constrain JUnit tests and @QuarkusComponentTests but @QuarkusComponentTest is in another artifact so this will have to do. Related to quarkusio#46035. Note that you can still break things if you specify another priority but that's how it is :). (cherry picked from commit 3b89af2)
Describe the bug
Having a
QuarkusTest
provide config overrides via theTestProfile
annotation pollutes the environment of other tests in the suite.I was able to debug the
QuarkusComponentTestExtension
and inspect the resolvedConfig
object. Using theorg.eclipse.microprofile.config.Config.getConfigValue
API, I was able to see that the incorrect config value was coming from system properties (I assume set by the quarkus test extension).Expected behavior
I understand the limitation with Quarkus tests and how the Test Profiles work by requiring a test ordering and a restarting of the Quarkus server (which is part of my motivation for wanting to move more of my tests to be
QuarkusComponentTest
s rather thanQuarkusTest
).However, it appears the orderer is unaware of
QuarkusComponentTest
s. It would seem the server needs to either restart after the lastQuarkusTest
with aTestProfile
, orQuarkusComponentTest
s needed to be ordered beforeQuarkusTest
s. I encountered this issue when my test order changed on a quarkus upgrade. However, this doesn't appear to be associated with any change to theQuarkusTestProfileAwareClassOrderer
.It's possible to work around this by extending
QuarkusTestProfileAwareClassOrderer
and overridinggetCustomOrderKey
to detect if the class is annotated withQuarkusComponentTest
. However, if it is a goal to increase the adoption ofQuarkusComponentTest
s then I think they should be included in the default orderingActual behavior
No response
How to Reproduce?
Reproducer: https://github.com/ryandens/quarkus-component-test-reproducer
QuarkusComponentTest
(resolving the non-default config value specified in theQuarkusTest
)QuarkusTest
and seeQuarkusComponentTest
now passes.quarkus.test.class-orderer
commented out. insrc/test/resources/application.properties
to see that changing the order of the test classes fixes this issueOutput of
uname -a
orver
Darwin Mac 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 18:56:34 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6020 arm64
Output of
java -version
OpenJDK 64-Bit Server VM Temurin-21.0.6+7 (build 21.0.6+7-LTS, mixed mode, sharing)
Quarkus version or git rev
3.18.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)------------------------------------------------------------ Gradle 8.12.1 ------------------------------------------------------------ Build time: 2025-01-24 12:55:12 UTC Revision: 0b1ee1ff81d1f4a26574ff4a362ac9180852b140 Kotlin: 2.0.21 Groovy: 3.0.22 Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024 Launcher JVM: 21.0.6 (Eclipse Adoptium 21.0.6+7-LTS) Daemon JVM: /Users/ryandens/.sdkman/candidates/java/21.0.6-tem (no JDK specified, using current Java home) OS: Mac OS X 15.2 aarch64
Additional information
No response
The text was updated successfully, but these errors were encountered: