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

Property expression quarkus.http.test-port with rest-client not working with 2.4.1 #21332

Closed
damian-burda opened this issue Nov 10, 2021 · 2 comments · Fixed by #21530
Closed
Labels
Milestone

Comments

@damian-burda
Copy link

damian-burda commented Nov 10, 2021

Describe the bug

I'm having problems after upgrading from 2.3.1.Final to 2.4.1 Final. I'm using property expressions to test my RestClient. The test application.yaml has following properties

  http:
    test-port: 0 # use random port
  rest-client:
    example-rest-client:
      url: 'http://localhost:${quarkus.http.test-port}'

so if the tests starts with random port like 61234 then the URL should be http://localhost:61234 . This works when using RestAssured. But this does not work for injected RestClient. But it did work before with 2.3.1.Final. So something must have changed in the mean time.

When debugging and checking the property with ConfigProvider.getConfig().getConfigValue("quarkus.rest-client.example-rest-client.url") it also shows correct URL. I have a strong feeling that this is connected with creation of io.quarkus.restclient.config.RestClientsConfig as it already has the incorrect URL.

It was discussed on Zulip

@radcortez wrote

Roberto Cortez: ok this is caused by #17220 and because REST Client configuration is now read from a ConfigRoot
Roberto Cortez: the issue is that ConfigRoots are eagerly initialized with the configuration when the app starts (before determining the test port)
Roberto Cortez: when the test port is mutated it is already too late, because the value is already set in the config root
Roberto Cortez: not exactly sure what can we do here. I need to discuss this and think about it first

Expected behavior

Property expressions evaluation works for rest-client properties with 2.4.1.Final

Actual behavior

Property expressions are not evaluated for rest-client

How to Reproduce?

Here is a small reproducer https://github.com/damian-burda/rest-client-prop-expression

Just build it with maven and the test will fail. Switch the version to 2.3.1.Final and it will work again.

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.4.1.Final

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

No response

Additional information

No response

@damian-burda damian-burda added the kind/bug Something isn't working label Nov 10, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 10, 2021

/cc @michalszynkiewicz

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 10, 2021

You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip.

This message is automatically generated by a bot.

@radcortez radcortez changed the title Property expressions with rest-client not working with 2.4.1 Property expression quarkus.http.test-port with rest-client not working with 2.4.1 Nov 10, 2021
@quarkus-bot quarkus-bot bot added this to the 2.6 - main milestone Nov 22, 2021
@gsmet gsmet modified the milestones: 2.6 - main, 2.5.1.Final Nov 29, 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.

3 participants