-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Test profile config properties can bleed into other test profiles #27996
Comments
/cc @geoand |
Seems like you have done some fine analysis. Would you be willing to provide a fix? |
A simple fix will probably be easy. A test should also be doable, although I have only ever encountered this in continuous testing, which makes me wonder why I don't see it under normal Maven test execution. I better fix may be to not rely on system properties, but a new config source. But for that I know too little about the inner workings of the Quarkus test framework. |
Sure, that would be the test fix, but if we can just reset the system property in the proper place, we can take care of this. |
…reset Instead of reverting the system properties which may get set by a Quarkus test as part of the `ExtensionState`'s `close()` operation, introduce a new `ShutdownTasks` resource which gets closed independently. Thus, it can perform tasks independently of whether the Quarkus application booted successfully or not. Fixes quarkusio#27996
/cc @geoand |
Reopen due to #42844 |
Describe the bug
I have run into the problem (I've seen this in dev-mode, but don't know if it is specific to that), that config properties which are provided by test profiles (using
QuarkusTestProfile#getConfigOverrides()
) can bleed into later tests which don't use that profile.I did some debugging and AFAICT the problem is in
io.quarkus.test.junit.QuarkusTestExtension#doJavaStart()
. In the calledcreateAugmentor()
method theRestorableSystemProperties.setProperties()
method is called which sets the profile's config overrides as system properties and also returns a shutdown handler to restore the previous values. ButdoJavaStart()
doesn't register these shutdown handlers until the very end and when executing the tests it is possible that these throw an exception (in my case I got anExceptionInInitializerError
which as its cause had anRuntimeException
with the messageFailed to start quarkus
. As a consequence the shutdown handlers never get registered and the profile's config properties remain available as system properties.Expected behavior
If profile config property overrides get set as system properties it must be ensured that these get properly reset / cleared, even if the test failed or throws exceptions.
Actual behavior
No response
How to Reproduce?
If requested I could look into provide a reproducer, but this may take some time.
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.12.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: