-
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
Support passing parameters to a QuarkusTestResource #9082
Conversation
45cc108
to
a87724d
Compare
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.
Interesting! I added a comment and a question.
test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java
Outdated
Show resolved
Hide resolved
test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java
Outdated
Show resolved
Hide resolved
bc27dcc
to
e7c1ecc
Compare
What happens if you have:
or something like that? |
The PR makes sure that the test fails |
Would an alternative be to instantiate |
I think that could lead to surpising results. Best keep with the established Quarkus practice. |
test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java
Outdated
Show resolved
Hide resolved
I see. One would have to create some "dummy" classes in these (hopefully rare) situations. I was for instance thinking of the situation where I need two datasources. Then I would have liked to declare two annotations like |
test-framework/common/src/main/java/io/quarkus/test/common/ResourceArg.java
Outdated
Show resolved
Hide resolved
...amework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceLifecycleManager.java
Outdated
Show resolved
Hide resolved
a4597ed
to
2079b4a
Compare
It might be just me but I think I would:
This way, we have the best of both world: flexibilty and keeping the behavior as is if you don't use initArgs. WDYT? |
@gsmet What you propose would also be my preferred solution. |
I don't know... I am not convinced about having different |
By the way, what's the status of having individual resources per test class? Anything planned? The way the annotation can be used and how it is documented (JavaDoc) leaves the impression you can have individual resources per test class. |
Nothing done so far, but hopefully soon :)
Would you like to propose a way for it to be written differently that would cause less confusion? As I mentioned before, I think that the if we allow |
So the question becomes, what should we do about this? |
I think that different args makes sense, e.g. starting two different databases of the same type is definitely a common use case, however I can see how it could be confusing. Maybe make this annotation @repeatable, IMHO this would make it clearer that it can be used to create multiple resources. |
|
CI failure has nothing to do with this PR:
|
@stuartwdouglas, @gsmet WDYT now? |
Resolves: #9066