visibility of src/main/resources/application.properties in test

133 views
Skip to first unread message

V. Sevel

unread,
Oct 29, 2020, 5:38:17 AM10/29/20
to Quarkus Development mailing list
hello,
an empty src/test/resources/application.properties seems to shadow existing properties in src/main/resources/application.properties

what is the best practice to add/override test properties on top of an existing non empty src/main/resources/application.properties (i.e. without copy/pasting all properties from src/main into src/test)?
thanks

Roberto Cortez

unread,
Oct 29, 2020, 6:39:53 AM10/29/20
to vvs...@gmail.com, Quarkus Development mailing list
Hi,

You may want to set test profile properties. Check here:

When running tests, the “test” profile is automatically activated. So you can override any property by using %test.property.name. You can place all of these in the main application properties file.

Hope it helps!

Cheers,
Roberto

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/6a485d2e-a42a-42ea-b6dd-d050f6281b32n%40googlegroups.com.

V. Sevel

unread,
Oct 29, 2020, 7:15:04 AM10/29/20
to Quarkus Development mailing list
I am not fond of adding test specific properties into the src/main/resources/application.properties
I believe springboot has more flexibility: you can put an application-test.properties in src/test, and it will be merged with application.properties from src/main
one way I was able to do it is by using a programmatic profile and loading an alternate file src/test/resources/application-test.properties myself in getConfigOverrides().
but we do not want users to do this. there should be native support in quarkus for that kind of pattern.

Roberto Cortez

unread,
Oct 30, 2020, 6:41:26 AM10/30/20
to vvs...@gmail.com, Quarkus Development mailing list
Hi,

There is already some work going to provide more flexibility:

The support will be there. Hopefully, soon :)

Cheers,
Roberto

V. Sevel

unread,
Oct 30, 2020, 7:45:43 AM10/30/20
to Quarkus Development mailing list
thanks for the links. I added my comments in the issue.
Reply all
Reply to author
Forward
0 new messages