-
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
Honor the environment variable for verifying the host at which the server is listening #8240
Conversation
You can inject the config property in the test instead: @ConfigProperty(name="quarkus.http.host", defaultValue="0.0.0.0")
String host; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, sorry, looks like it doesn't work with native 😞
[ERROR] Failures:
[ERROR] JaxRSITCase>JaxRSTestCase.testConfigInjectionOfPort:40 1 expectation failed.
Response body doesn't match expectation.
Expected: is null
Actual: 0.0.0.0
What happens if you change to |
Injection is not yet supported in Native tests - https://quarkus.io/guides/getting-started-testing#native-executable-testing |
so, would you recommend that I move it back to checking for environment variables? That is what I started with originally. |
For a reference, my original commit had the following change,
If you are ok with it, I can update the commit. |
Isn't easier to just check if the body response is not empty or null? |
@gastaldi The original test was checking for |
I know, I mean that the possible values for this test are |
Just another shot: try getting the |
The reason is that we should avoid reading from |
Agreed. Wouldn't the suggested fix do the same, giving the additional possibility of honoring a system environment value? I am good either ways. What would you recommend? |
I'm fine with either TBH ;) |
…rver is listening.
@gastaldi Done. I have switched to using MP config instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
Sometimes, when running on a VPN,
0.0.0.0
is inaccessible and it forces me to set theQUARKUS_HTTP_HOST
environment variable tolocalhost
. There is one test case that does not honor the explicit environment variable setting. This PR fixes that problem.I don't know if there is a better way of doing it, but I'm open to suggestions.