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

Config: 'missing' properties when using quarkus.test.native-image-profile=test #33048

Closed
schulzp opened this issue May 2, 2023 · 2 comments · Fixed by #41170
Closed

Config: 'missing' properties when using quarkus.test.native-image-profile=test #33048

schulzp opened this issue May 2, 2023 · 2 comments · Fixed by #41170
Assignees
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@schulzp
Copy link
Contributor

schulzp commented May 2, 2023

Describe the bug

Ever since we migrated to Quarkus 3.0.1 our native integration tests started to fail, see minimal working example. We have the following properties defined in our application.properties:

example.push.apn.enabled=false
%prod.example.push.apn.enabled=true
example.push.apn.server=api.sandbox.push.apple.com
%prod.example.push.apn.server=api.push.apple.com
example.push.apn.signing-key=base64-encoded-key
example.push.apn.signing-key-id=key-id
example.push.apn.team-id=team-id
example.push.apn.topic=bundle-id

Yet, when booting the containerized native binary, it fails:

io.smallrye.config.ConfigValidationException: Configuration validation failed:
	java.util.NoSuchElementException: SRCFG00014: The config property example.push.apn.server is required but it could not be found in any config source
	java.util.NoSuchElementException: SRCFG00014: The config property example.push.apn.enabled is required but it could not be found in any config source
	at io.smallrye.config.ConfigMappingProvider.mapConfigurationInternal(ConfigMappingProvider.java:979)

Weirdly, only those properties are considered missing that are also overriden with a %prod prefix.

Expected behavior

We would expect properties, that are defined in application.properties, without profile prefix, to be used as defaults, when no prefixed property exists. No matter if the application runs on a JVM or as containerized, native binary.

Actual behavior

The containerized native binary application fails to boot if quarkus.test.native-image-profile=test is set and application.properties contains properties and %prod-prefixed overrides.

How to Reproduce?

Please see our minimal working example. All you have to do is run ./mvnw clean verify -Pnative.

Output of uname -a or ver

Darwin wmf3196 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

Output of java -version

version: 17.0.5, vendor: BellSoft

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.0.1

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

Apache Maven 3.8.6

Additional information

No response

@schulzp schulzp added the kind/bug Something isn't working label May 2, 2023
@gsmet
Copy link
Member

gsmet commented May 2, 2023

@radcortez we probably need to sort this out and understand if it's a regression soonish.

@radcortez
Copy link
Member

I don't think this is a regression, but an interesting case in how we build and test the app.

When we build the native image, we build it with the prod profile, and when we test it, we run the native binary with the test profile, not prod. Because we build with prod and the prod properties take precedence over the unprofiled ones, these are the only ones being recorded in the native image.

This also relates to #20730.

Let me see what I can do. In the meantime, as a workaround, you can just add the following properties to the file:

%test.example.push.apn.enabled=true
%test.example.push.apn.server=api.push.apple.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants