You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When @TestProfile is used to use a non-standard config profile, then the profile-specific file (like application-french.properties in the attached example) is only found if it resides in src/main/resources. not when in src/test/resources.
It should be possible for a test to use a profile-specific config file, which is in the test folder src/test/resources. Currently this is not the case.
Actual behavior
It would appear that a Quarkus Test with an @TestProfile annotation only loads the profile-specific application.properties file from src/main/resources.
How to Reproduce?
Build the attached example using mvn verify and the test GreetingResourceTest (see below) will fail.
Ah, you are missing an application.properties file (it may even be empty) to make the resource discoverable. This is to keep a consistent loading order and match with the unprofiled resource.
The issue is that if we call ClassLoader#getResources on each individual file pattern, we end up with unordered files and we don't know how to set the priorities. I guess we could look into the entire path and try to match them, but we took an easier approach which is, we load only application.properties, and if that exists in we look for profile files in the same location. So the loading order is consistent and we know easily who overrides who.
What we do need is to clarify that in the documentation.
Describe the bug
When
@TestProfile
is used to use a non-standard config profile, then the profile-specific file (likeapplication-french.properties
in the attached example) is only found if it resides insrc/main/resources
. not when insrc/test/resources
.Example project to reproduce the issue: code-with-quarkus.zip
Expected behavior
It should be possible for a test to use a profile-specific config file, which is in the test folder
src/test/resources
. Currently this is not the case.Actual behavior
It would appear that a Quarkus Test with an
@TestProfile
annotation only loads the profile-specificapplication.properties
file fromsrc/main/resources
.How to Reproduce?
Build the attached example using
mvn verify
and the testGreetingResourceTest
(see below) will fail.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.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: