-
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
mp-rest config settings from application.properties are ignored when using test-profile #19456
Comments
Removing the mandrel tag. |
We've discovered that removing the /controls/tag part of the url from the mp-rest definition and putting that part in the @path annotation makes this work in test profile also. It still doesn't seem right that the original url set up in the mp-rest config works in prod profile but not in test profile though. |
Is this still an issue with |
From what I did see looking at the code, I would say this is expected behavior. So I am going to close this. Feel free to reopen if you feel it has not been properly addressed |
Describe the bug
I'm trying to load a file and validate some of the contents using data retrieved from a remote rest endpoint (TagService is my class to do this with @RegisterRestClient here). To set this up I've configured connection details in application.properties using mp-rest for TagService. This works fine.
In my unit tests I initially mocked out the operation of TagService succesfully using Mockito but I wanted to run the test methods in ImportServiceTest as a @NativeImageTest via extension so I removed this and set up a Wiremock mock http server for the remote Tag endpoint.
This fails, the GET request doesn't hit the wiremock server. By putting the connection details into the annotations on the TagService class (and commenting out the relevant application.properties lines) the wiremock server GET request is successful ( these lines are commented out in the reproducer and can be uncommented to prove the successful GET request).
It appears that in test mode mp-rest rest client config from application.properties is ignored or not used anyway.
This behaviour is the same whether running tests in jvm mode or as a NativeImageTest.
Expected behavior
the ImportServiceTest should pass and the list of tags retrieved from the wiremock server should be visible in the console output:
tag: Tomcat, tagType: Runtime
tag: Java EE, tagType: Language
tag: RHEL 8, tagType: Operating System
tag: Oracle, tagType: Database
Actual behavior
the ImportServiceTest method fails.
In the console output there's a wiremock error like this:
How to Reproduce?
Reproducer: https://github.com/m-brophy/quarkus-test-profile-mp-rest-reproducer
Steps to reproduce behaviour:
1: run ./mvnw clean test from project root to see the failure
2: uncomment the config definitions in TagService @RegisterRestClient and @path annotations and comment out the mp-rest definitions in application.properties
3: run ./mvnw clean test again and it will succeed.
Output of
uname -a
orver
Linux localhost.localdomain 5.13.9-100.fc33.x86_64 #1 SMP Mon Aug 9 12:04:50 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment 18.9 (build 11.0.10+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode)
GraalVM version (if different from Java)
Running Quarkus native-image plugin on GraalVM Version 20.3.3.0-Final (Mandrel Distribution) (Java Version 11.0.12+7)
Quarkus version or git rev
Quarkus 1.13.1.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Additional information
No response
The text was updated successfully, but these errors were encountered: