Skip to content
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

QuarkusTestResources all started no matter what #10174

Closed
gboro54 opened this issue Jun 23, 2020 · 16 comments
Closed

QuarkusTestResources all started no matter what #10174

gboro54 opened this issue Jun 23, 2020 · 16 comments
Labels
kind/bug Something isn't working
Milestone

Comments

@gboro54
Copy link

gboro54 commented Jun 23, 2020

Describe the bug
I have 2 quarkus test and 2 seperate test resources (1 for starting a MySQL container and another for starting a LocalStack container). Each of the test classes are annotated with @QuarkusTestResource for there resource.

Expected behavior
Since each test class is independent and has different resources I would expect to only see the resource assigned to that class to start

Actual behavior
No matter which test I seem to run both QuarkusTestResourceLifecycleManager seems to start up

To Reproduce
Steps to reproduce the behavior:
1.
2.
3.

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version:
  • GraalVM version (if different from Java):
  • Quarkus version or git rev:
  • Build tool (ie. output of mvnw --version or gradlew --version):

Additional context
(Add any other context about the problem here.)

@gboro54 gboro54 added the kind/bug Something isn't working label Jun 23, 2020
@famod
Copy link
Member

famod commented Jun 23, 2020

Seems related: #9854

@famod
Copy link
Member

famod commented Jun 23, 2020

@geoand this topic seems to be coming back again and again (in various manifestations).

I was thinking that maybe QuarkusTestResourceLifecycleManagers could somehow be started lazily?
I suppose in that case a manager could not contribute system properties anymore?

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

With the current design we can't have that - all QuarkusTestResourceLifecycleManager classes are used for all tests.

However, with the advent of QuarkusTestProfile we do plan to make test profile specific QuarkusTestResourceLifecycleManager work.

That probably won't be part of 1.6 though

@famod
Copy link
Member

famod commented Jun 23, 2020

How is QuarkusTestProfile going to work? Do I have to activate it via a property?

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

It already works, take a look at the examples in the codebase.

What isn't there is integration with QuarkusTestResourceLifecycleManager (which I doubt I'll have time to get in for 1.6, but you never know)

@famod
Copy link
Member

famod commented Jun 23, 2020

Ok found the docs: https://github.com/quarkusio/quarkus/pull/9933/files#diff-47ba67a53b8e59e00a94c37fdc60c396

This is a nice improvement. I don't like the sort-by-package approach since packaging shoud be driven by business (and visibility) rules but I do know you cannot do anything about sorting test classes since surefire plugin is deciding that on its own.

I guess -Dtest=... will only active the profile of the selected tests?

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

Ok found the docs: https://github.com/quarkusio/quarkus/pull/9933/files#diff-47ba67a53b8e59e00a94c37fdc60c396

This is a nice improvement. I don't like the sort-by-package approach since packaging shoud be driven by business (and visibility) rules but I do know you cannot do anything about sorting test classes since surefire plugin is deciding that on its own.

The sorting is proposed as a way of minimizing the number of Quarkus restarts necessary.

I guess -Dtest=... will only active the profile of the selected tests?

It should. If it doesn't, then please open an issue

@famod
Copy link
Member

famod commented Jun 23, 2020

Btw, back in 2017 there was an attempt to add custom sorting strategies to surefire: apache/maven-surefire#169

@gboro54
Copy link
Author

gboro54 commented Jun 23, 2020

are QuarkusTestProfile in 1.5.2.Final?

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

No, it will part of 1.6.0.Final

@gboro54
Copy link
Author

gboro54 commented Jun 23, 2020

Ignore I can see that its targeted towards 1.6.0

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

@famod did you try using the test profile? Do you have any feedback?

@famod
Copy link
Member

famod commented Jun 23, 2020

@geoand

@famod did you try using the test profile? Do you have any feedback?

No, sorry. Busy with other stuff.

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

No worries, thanks

@geoand
Copy link
Contributor

geoand commented Jul 1, 2020

#10368 is related to this

@geoand
Copy link
Contributor

geoand commented Jul 8, 2020

Closing this as #10368 has been merged and will be part of 1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants