-
Notifications
You must be signed in to change notification settings - Fork 3k
Add inline configuration support to QuarkusUnitTest and remove obsolete test config files (#51206) #51322
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
base: main
Are you sure you want to change the base?
Add inline configuration support to QuarkusUnitTest and remove obsolete test config files (#51206) #51322
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
ef63778 to
d57d397
Compare
|
@gsmet whenever you have some time, I'd really appreciate a review on this PR. |
|
thanks for the PR @mathias82 I'll review it soon In the meanwhile, have you checked |
Yes the test its working as expected @lucamolteni |
radcortez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR.
Can you please do the same for io.quarkus.test.QuarkusUnitTest#overrideRuntimeConfigKey?
Also io.quarkus.test.QuarkusProdModeTest#overrideConfigKey.
Thank you!
|
@mathias82 I see you've removed |
I removed The remaining compatibility tests still need both: quarkus.datasource.reactive.url=${postgres.reactive.url} Those Hope this clarifies the difference! |
…time config in QuarkusUnitTest
|
test(junit5-internal): replace application.properties with inline runtime config in QuarkusUnitTest This change removes the need for external application.properties files in Key changes:
|
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-test-common</artifactId> | ||
| </dependency> | ||
| <dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum... I'm not sure whether we should include arc here. What is the reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the question!
In this test QuarkusUnitTestWithRuntimeConfigurationTest I explicitly added the arc dependency because the class uses Quarkus Arc annotations:
import io.quarkus.arc.Unremovable;
import jakarta.inject.Singleton;
These annotations are part of the Arc CDI implementation, not part of the quarkus-test-common artifact. Without including arc, the test fails to compile because the Arc annotation types are not available on the classpath during the test scope.
In other words, Arc is required here to correctly load and process the CDI metadata used in this test. If we remove arc, the test breaks.
If you believe there is another recommended dependency that exposes these annotations without pulling the whole Arc module, I'm happy to revisit it, but currently this is the minimal dependency that makes the test compile and run.
Add inline configuration support to QuarkusUnitTest and remove obsolete test config files (#51206)
This commit introduces a new API method
withConfiguration(String)that enablesinline configuration for QuarkusUnitTest using Java text blocks. The method
parses
key=valueproperties and forwards them tooverrideConfigKey(...),eliminating the need for external
.propertiesfiles or multiple configurationcalls in test code.
As part of this enhancement and in relation to issue #51206, obsolete test configuration
resources such as
application-unittest-onlyreactive*.propertieswere removed,since Dev Services now provide datasource URLs automatically and these files were
no longer required.
A new test
QuarkusUnitTestWithConfigurationTestverifies that inline configurationis correctly applied and propagated to the MicroProfile Config runtime.
overrideConfigKeyto test Hibernate tests instead of application.properties files #51206