-
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
Introduce @WithTestResource
as an analogous to @QuarkusTestResource(restrictAnnotatedClass=true)
#37853
Comments
/cc @geoand (testing) |
I admit that reading the thread the default surprised me too and the attribute name is quite long vs for example just global=true|false. So I grok the wish/request. 4.0 is not even planned yet except we know it's not happening anytime soon. My question/concern is how big a breakage this will be and how many users will have to add restrictToAnnotatedClass=false to make their tests pass. I do assume we can handle it in quarkus update but it's still problematic if everyone is affected. Are there better alternatives?
|
It could easily result in most tests of a testsuite failing
Indeed |
Another alternative would be to use a new annotation and deprecate the existing one |
+1 I don't think it's a good idea to defer such changes to a "major release", unless there's no alternative:
|
I agree with what everyone has said here. Not that I'm advocating for keeping the existing annotation, but using something like OpenRewrite would be pretty simple during a Deprecating an existing annotation and replacing it with another with all the same properties but just different defaults seems clunky to me. @geoand is right - it could break an entire test suite, but I think in those cases those people would be of the same realization - that things were working in a way that they didn't know/understand it was working that way. I would venture to guess that the majority of people who specify |
An alternative could be to retain the old behavior with a feature flag in the configuration. For example:
With this one set, the default behavior returns to making TestResources global. If not set we restrict to annotated class only. |
@tqvarnst, I think that's in effect one of the proposals @maxandersen put forth, but we have generally shied away from allowing such kind of behavioral change via configuration. |
The more I think of it, the more I am in favor of introducing a new annotation and deprecating the old one. |
Naming things is hard :) I think How about something like |
|
I like |
Let's also ask @gsmet who is good with naming things |
@geoand any problems with me taking this up? |
Yeah, I think adding the new annotation makes sense! |
restrictToAnnotatedClass
in @QuarkusTestResource
to true
in next major version@WithTestResource
as an analogous to @QuarkusTestResource(restrictAnnotatedClass=true)
I updated the title of the issue to reflect the latest status |
Description
This is spawned from this thread - https://twitter.com/cowtowncoder/status/1736913697426338262
In the next major version of Quarkus (where we can make breaking changes) we should default
restrictAnnotatedClass
on theQuarkusTestResource
annotation totrue
.Implementation ideas
No response
The text was updated successfully, but these errors were encountered: