-
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
Strange behaviour of QuarkusTestResourceLifecycleManager #43682
Comments
I forgot to mention that I'm using the |
Do you mind putting a sample together that shows the problem in action? Thanks |
@geoand : I agree it's hard to understand. Here is a reproducer. To reproduce, proceed as follows:
This should work as expected, except the
This should reproduce the exception. |
Thanks a lot. Next week I likely won't be around, so I'll likely try the week after |
To resume, what seems to happen is that, in a test class hierarchy, where the test classes extend an abstract class which declares But as soon as the abstract class, together with the test resource class, is isolated in a separate test JAR, i.e. a JAR built with
and this test jar is used as a test dependency, i.e I tried to figure out what happens, but unsuccessfully. Perhaps something related to the fact of using a test JAR ? I didn't try to change that such that to use a normal JAR because, in this case, I'd have had to move the test scoped dependencies in compile scoped ones, which wouldn't have made sense with artifacts like |
Thanks for looking into this. What you are seeing is indeed a limitation of how we discover |
Okay, I'll have to experience something like that, thanks. But my understanding is that |
That is correct |
Describe the bug
With Quarkus 3.15.1, I'm using
QuarkusTestResourceLifecycleManager
to rundocker
images viatestcontainers
. The filepackage.png
here attached shows the class diagram of a simple test project.The class
AbstractCurrentTimeResource
defines test resource as follows:The class
MyTestResource
implementsQuarkusTestResourceLifecycleManager
and starts thedocker
image required for testing. On itsstart
method it returns the MP Config property which contains the URL of the deployed service under test.Everything works as expected, excepting the fact that the
docker
image isn't reused across the tests but it's started and stopped for each single test. I can live with that waiting for the 3.16.At this point all the mentioned classes belong to the same and unique Maven artifact. But now I need to share between several projects the calsses
MyTestResources
andAbstractCurrentTimeResource
. I'm extracting them in a separate Maven artifact which I include as a dependency in the consumer projects. And then the MP Config property supposed to contain the URL of the service under test isn't resolved any more. It looks likeAbstractCurrentTimeResource
which is extended by the concrete test classCurrentTimeIT
isn't executed any more, which is probably impossible.Expected behavior
I expect that externalizing in a different Maven artifact the classes
AbstractCurrentTimeResource
andMyTestResource
works exactly the same as they do when included in the same artifact asCurrentTimeIT
.Actual behavior
Externalizing the lifetime management classes from the integration test class doesn't work and raises the following exception:
How to Reproduce?
I could provide a reproducer if required.
Output of
uname -a
orver
Linux nicolas-XPS-15-9570 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
java version "21.0.3" 2024-04-16 LTS Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152) Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)
Quarkus version or git rev
3.15.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546) Maven home: /opt/apache-maven-3.9.5 Java version: 21.0.3, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-21-oracle-x64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "6.8.0-45-generic", arch: "amd64", family: "unix"
Additional information
N/A
The text was updated successfully, but these errors were encountered: