-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
QuarkusComponentTest: register default and support custom converters #41747
Conversation
mkouba
commented
Jul 8, 2024
- fixes QuarkusComponentTest does not register Quarkus Config Converters #41709
CC @diversit |
This comment has been minimized.
This comment has been minimized.
@@ -421,6 +422,7 @@ private void startContainer(ExtensionContext context, Lifecycle testInstanceLife | |||
ClassLoader tccl = Thread.currentThread().getContextClassLoader(); | |||
SmallRyeConfigBuilder configBuilder = new SmallRyeConfigBuilder().forClassLoader(tccl) |
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.
Couldn't we use https://github.com/quarkusio/quarkus/blob/main/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java#L76 and let the Converters
be discovered?
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.
We could but I'm not 100% sure it's the best fit for QuarkusComponentTest
.
For example, we create a new Config
for each test method. And the discovery itself could be quite expensive. Also the discovered components may require some functionality provided by Quarkus runtime - which might not be available in QuarkusComponentTest
.
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.
That said, we could make it configurable...
Actually, it would make more sense to allow the test to modify the SmallRyeConfigBuilder
. This would be a more advanced feature compared to the QuarkusComponentTest#configConverters()
. And it could be only used from the QuarkusComponentTestExtensionBuilder
.
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.
Done.
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.
SmallRyeConfigBuilder
can be customized via https://smallrye.io/smallrye-config/3.8.3/config/customizer/
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.
I see. But the functionality is no different compared to the plain Consumer<SmallRyeConfigBuilder>
in this PR, is it?
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.
No. It was just to let you know there is a way to influence the SmallRyeConfigBuilder
via ServiceLoader
, so you may not need a specific API to expose it.
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.
I get it, but in the context of QuarkusComponentTest
we would like to avoid using ServiceLoader
s.
This comment has been minimized.
This comment has been minimized.
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.
Added just a minor note, otherwise LGTM.
...it5-component/src/main/java/io/quarkus/test/component/QuarkusComponentTestConfiguration.java
Show resolved
Hide resolved
Status for workflow
|