-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
QuarkusTestResource not working with QuarkusMainLauncher #45868
Comments
Thanks for reporting! I tried your sample but it doesn't seem to compile. Is it missing lombok or something? |
My mistake, I removed Lombok to keep the reproducer as simple as possible, but managed to forget to commit some changes. It should compile now. |
@radcortez it seems that is caused by the fact that the properties hang around even after the test is executed. What is the proper way to clear them with the changes that have been made? |
I'm unsure if the problem is with the clear of the properties. When I execute the |
When a test that uses |
But not because the properties were not cleared, it is because |
That's now what I'm seeing. |
In the case of
|
This is the one I don't see. I see |
Is it? Because that is the piece setting the properties, which makes the configuration visible to the test. The same test code in |
This is related to #27996. While there is a clear of the config during quarkus/test-framework/common/src/main/java/io/quarkus/test/common/TestResourceManager.java Lines 232 to 245 in 4da51b3
System : Lines 135 to 199 in 8f5e156
We really need to remove this way of passing configuration. Even if we clear the properly correctly, it is going to be unreliable if the tests execute in parallel. |
+1 |
Describe the bug
I have a Quarkus Picocli application that among other things takes the URL to a JSON Schema catalog. That URL is then verified to exist.
For testing, I set up a QuarkusTestResource of a WireMockServer that returns some test files that would return true if verified.
For the tests itself, I used a mix of the "@Launch" annotation and the QuarkusMainLauncher. I used the second option if I needed the server so I could get the port currently in use. If I didn't need the server, I just used "@Launch".
The problem now arises if I try to execute the tests:
Let's assume I have three tests a, b and c, while a and c use the QuarkusMainLauncher and b uses "@Launch".
When all are executed a will fail because the TestResource hasn't been executed, the error is that the Property used for saving the URL couldn't be found. b and c will run without issue.
If I know disable b bot a and c will fail with the same error:
Expected behavior
I'd expect it to not matter if I use "@Launch" or QuarkusMainLauncher in combination with a QuarkusTestResource.
Actual behavior
As I see it, a "@Launch" test is required to run before a QuarkusTestResource can be used with a test that needs QuarkusMainLauncher.
How to Reproduce?
Reproducer: https://github.com/SKreileder/exampleTestResourceQuarkusMainLauncher
Steps to reproduce:
Output of
uname -a
orver
Linux stefan-21k90009ge 6.11.11-1-MANJARO #1 SMP PREEMPT_DYNAMIC Thu, 05 Dec 2024 16:26:44 +0000 x86_64 GNU/Linux
Output of
java -version
java 21.0.5 2024-10-15 LTS Java(TM) SE Runtime Environment Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48, mixed mode, sharing)
Quarkus version or git rev
3.17.8
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: /usr/share/java/maven Java version: 21.0.5, vendor: Oracle Corporation, runtime: /home/stefank/.sdkman/candidates/java/21.0.5-graal Default locale: de_DE, platform encoding: UTF-8 OS name: "linux", version: "6.11.11-1-manjaro", arch: "amd64", family: "unix"
Additional information
No response
The text was updated successfully, but these errors were encountered: