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

quarkus-rest-client-reactive related configuration properties problem #21533

Closed
nikosk686 opened this issue Nov 18, 2021 · 7 comments · Fixed by #21620
Closed

quarkus-rest-client-reactive related configuration properties problem #21533

nikosk686 opened this issue Nov 18, 2021 · 7 comments · Fixed by #21620
Labels
Milestone

Comments

@nikosk686
Copy link

Describe the bug

Seems to be related to this one

Tests ignore the %test properties for rest clients and try to use the %prod ones instead.
So having properties like these causes a failure in test that try to expand the prod value

%prod.external-service/mp-rest/url=${EXTERNAL_SERVICE_URL}
%test.external-service/mp-rest/url=http://localhost:8000

Expected behavior

Tests should use the correct profile's properties of rest clients

Actual behavior

Tests use the prod profile's properties of rest clients

How to Reproduce?

Reproducer: https://github.com/nikosk686/quarkus-config-properties-error-showcase

Try to run the test on the example linked above.
The error is:

Caused by: io.quarkus.runtime.configuration.ConfigurationException: One or more configuration errors have prevented the application from starting. The errors are: - SRCFG00011: Could not expand value EXTERNAL_SERVICE_URL in property %prod.external-service/mp-rest/url

Workaround, add a default value %prod.external-service/mp-rest/url=${EXTERNAL_SERVICE_URL:}
and the test passes

Output of uname -a or ver

Linux dell-desktop 5.10.0-1051-oem #53-Ubuntu SMP Thu Oct 28 08:11:53 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

correto-11 version 11.0.13

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.4.2.Final

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

Gradle 7.3

Additional information

No response

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

quarkus-bot bot commented Nov 18, 2021

/cc @michalszynkiewicz

@geoand
Copy link
Contributor

geoand commented Nov 22, 2021

cc @TomasHofman @radcortez

@TomasHofman
Copy link
Contributor

I will have a look.

@TomasHofman
Copy link
Contributor

Thanks for well written bug report!

I think the problem is in incorrect implementation of the RestClientFallbackConfigSourceInterceptor#iterateNames() method. When the interceptor sees property like %prod.config-key/mp-rest/url, it tries to convert it to the new notation and the result is something like quarkus.rest-client.%prod.config-key.url. Later on, because this prop name is included in the iteration result, the property value is attempted to be expanded. The expansion fails because the value contains undefined variable (${EXTERNAL_SERVICE_URL}), which otherwise would not be needed in this scope.

I'm going to open a PR.

@BonomoAlessandro
Copy link

The on this page described bug is not fully resolved I guess.
I'm using Quarkus 2.5.1.Final.

If I run my tests with the properties defined like this, it will take the correct %test property.
%prod.external-service/mp-rest/url=${EXTERNAL_SERVICE_URL}
%test.external-service/mp-rest/url=http://localhost:8000

If I run my tests with just the test profile property it will also take the correct %test property.
%test.external-service/mp-rest/url=http://localhost:8000

But if I define the properties like the following, it will take the default property instead.
external-service/mp-rest/url=${EXTERNAL_SERVICE_URL}
%test.external-service/mp-rest/url=http://localhost:8000

Like on page Quarkus - CONFIGURATION REFERENCE GUIDE documented it should take the %test property if I run my tests.

@TomasHofman
Copy link
Contributor

I will have a look at that.

@TomasHofman
Copy link
Contributor

@BonomoAlessandro I can't reproduce your problem with 2.5.1.Final neither with current main. Can you open a new issue with a small reproducer if you still experience it?

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.

5 participants