-
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
application-test.yaml not taken into account when using -Dquarkus.test.native-image-profile=test #27266
Comments
hello any news on this? |
I suppose that the build profile is still Do you get the message: If this is the case, the profile-aware file will not work, because it is not recorded with the native image. The profile-aware properties work because they are listed in I guess that recording the profile from Ideally, you should build the native image with the profile you want to use, so setting Registering the resource for native-image, also works, but you need to register both files: |
yes. and that seems the correct thing to do. right? I would not want to build with some test profile and send that build to prod. and I would not want to build once with a test profile for testing only, and once with the prod profile when I ship to production, because that would mean to production an untested build (at least during CI) because of the current behavior, I ended up building with
yes:
you mean it is supposed to also capture an
ideally, no I would not want to include test resources in an app I am sending to prod.
I have to build using the one option would be to create a |
Not at the moment, because we are not recording the profile set in
Yes, I agree.
Yes, that should work. If it doesn't, I'll say it is a bug and we need to fix it. |
but |
You can set specific properties in the surefire / failsafe plugin. |
this is working fine.
I added file
and in
during the build I see:
and when I run the app in production, I see:
and there is no more I was just surprised that the
final question: should we add this pattern in the quarkus doc? |
Do you mean that adding the property in About the rest, are you ok sending a PR to the docs with this info? Thank you! |
ok I will
yes that was the idea |
Sorry, I meant to say that |
hello. I did some more tests.
|
hmm actually, no it is not working:
and when I start the app, with no properties and startup code:
then it shows:
so the config locations comes was included in my binary, and not used only in the context of the failsafe plugin. we have to find a way to pass |
I have tried:
but that does not work (I did not have too much hope). |
Both of these works: <environmentVariables>
<QUARKUS_CONFIG_LOCATIONS>./src/main/resources/application-test.properties</QUARKUS_CONFIG_LOCATIONS>
</environmentVariables> <systemProperties>
<quarkus.test.arg-line>-Dquarkus.config.locations=./src/main/resources/application-test.properties</quarkus.test.arg-line>
</systemProperties> We are not propagating the system properties from the failsafe plugin to the integration test launcher. I can't remember a reason not to do it, considering that @geoand any thoughts? |
Probably because env variables are read-only in Java. A work around would be to expose the env variables via system properties using |
@radcortez it's probably just an oversight |
Ok, I'll see if I can implement something that propagates the properties. |
@radcortez yes, successfully validated on my side. this is an acceptable solution. it would be more consistent if system property variables worked as well, but I would be happy even if it stayed that way. as discussed previously, I am willing to document once we establish all valid options. |
We want to implement the propagation of system properties. I'll do it when I find some time for it :) In the meanwhile, feel free to propose a doc update. Thanks :) |
Describe the bug
I am following the BUILDING A NATIVE EXECUTABLE - Profiles documentation.
We have tried moving all
%test
properties into a separate fileapplication-test.yaml
, but this flavor does not seem supported: the application does not those properties when they are moved.Expected behavior
We should be able to expression properties for the native tests with a custom profile with both flavors
%test
orapplication-test.yaml
.Actual behavior
Properties coming from
application-test.yaml
are ignored in spite of using-Dquarkus.test.native-image-profile=test
.How to Reproduce?
Follow the example in https://quarkus.io/guides/building-native-image#profiles, and transfer
%test
in a separate fileapplication-test.yaml
, launch the app and verify that properties coming from the separate file are not taken into account.Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.8.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
we tried forcing the
application-test.yaml
to be in the target executable with:But that did not help.
The text was updated successfully, but these errors were encountered: