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

QuarkusIntegrationTest cannot be run with failsafe in JVM mode #18537

Closed
languitar opened this issue Jul 8, 2021 · 8 comments · Fixed by #18547
Closed

QuarkusIntegrationTest cannot be run with failsafe in JVM mode #18537

languitar opened this issue Jul 8, 2021 · 8 comments · Fixed by #18547
Assignees
Labels
Milestone

Comments

@languitar
Copy link
Contributor

languitar commented Jul 8, 2021

Describe the bug

When trying to use failsafe to run a @QuarkusIntegrationTest in JVM mode (outside the native profile), test executions fails.

Expected behavior

As documented here, QuarkusIntegrationTest can be run with failsafe.

Actual behavior

Test execution fails with the following error message, GreetingResourceTestIT being the test class annotated with @QuarkusIntegrationTest:

[INFO] Running org.acme.rest.GreetingResourceIT
2021-07-08 18:50:04,290 WARN  [io.qua.hib.orm.run.pro.ProxyDefinitions] (main) Could not generate an enhanced proxy for entity 'org.acme.rest.FooEntity' (class='org.acme.rest.FooEntity') as it's final. Your application might perform better if we're allowed to extend it.
2021-07-08 18:50:04,942 INFO  [io.quarkus] (main) Quarkus 2.0.1.Final on JVM started in 2.115s. Listening on: http://localhost:8081
2021-07-08 18:50:04,942 INFO  [io.quarkus] (main) Profile test activated. 
2021-07-08 18:50:04,942 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache-kotlin, jdbc-h2, kotlin, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.254 s <<< FAILURE! - in org.acme.rest.GreetingResourceIT
[ERROR] org.acme.rest.GreetingResourceIT  Time elapsed: 4.254 s  <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: No bean found for required type [class org.acme.rest.GreetingResourceIT] and qualifiers [[]]

To Reproduce

  1. Clone the reproduction repository
  2. mvn verify

I also tried reproducing this from an even smaller project, but then this bug is not triggered. So there might be an interaction with other extensions configured in this project.

Configuration

included

Environment (please complete the following information):

Output of uname -a or ver

Linux pres 5.10.47-1-lts #1 SMP Wed, 30 Jun 2021 13:52:19 +0000 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9)
OpenJDK 64-Bit Server VM (build 11.0.11+9, mixed mode)

GraalVM version (if different from Java)

not needed

Quarkus version or git rev

2.0.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (NON-CANONICAL_2021-04-26T21:52:54Z_root)
Maven home: /opt/maven
Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.47-1-lts", arch: "amd64", family: "unix"

Additional context

(Add any other context about the problem here.)

@languitar languitar added the kind/bug Something isn't working label Jul 8, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 8, 2021

/cc @evanchooly, @geoand

@geoand
Copy link
Contributor

geoand commented Jul 8, 2021

Thanks for reporting

@geoand geoand self-assigned this Jul 8, 2021
@geoand
Copy link
Contributor

geoand commented Jul 8, 2021

The problem is caused by the use of

<junit.jupiter.testinstance.lifecycle.default>per_class</junit.jupiter.testinstance.lifecycle.default>

I'll have a fix soon

@geoand
Copy link
Contributor

geoand commented Jul 8, 2021

It seems like there is some kind of bug in either failsafe or JUnit 5 that prevents per_class to work with either @NativeImageTest or @QuarkusIntegrationTest.

It throws some obscure NPE without a stacktrace when I apply my (very simple) fix to the Quarkus code.

@stuartwdouglas does that ring any bells?

@languitar
Copy link
Contributor Author

Could this fix also help running test cases in IntelliJ? I am seeing the same bean error there, too.

@stuartwdouglas
Copy link
Member

Are they QuarkusIntegrationTests that you are having trouble with? If so then yes.

@geoand
Copy link
Contributor

geoand commented Jul 12, 2021

You can try building Quarkus from source to make sure

@languitar
Copy link
Contributor Author

Are they QuarkusIntegrationTests that you are having trouble with? If so then yes.

Yes, in IntelliJ they result in the same bean resolution issue, even though there is no system property defined to trigger the per_class lifecycle.

@gsmet gsmet modified the milestones: 2.1 - main, 2.0.2.Final Jul 12, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants