Quick poll. Should a server under test be configur...
# ktor
a
Quick poll. Should a server under test be configured with
application.conf
from the
main
sourceset if the config in the
test
sourceset is absent?
👌
🚫
🚫 3
👌 9
a
Yes and no. for tests, it is rather important to be able to override the properties dynamically. Because if we speak of testing in the context of a web framework, it most likely means that we are talking about integration tests. And today people use containers to boot the external dependencies for such testing, e.g. Testcontainers. Hence, even if the test app can configure itself with application.conf it is not enough - it should be possible to override the individual properties depending on the conditions when the test is already running
âž• 2
(I know my answer wasn’t exactly to the question posted 🙂 but I couldn’t resist)
a
So your point is that a
test
config should override properties in
main
config?
a
no-no-no. I think it wouldn’t be a great idea. picking up config from main if it’s not present in test is ok. but it should be possible to override the individual properties in the test code itself, doesn’t matter from where the config is loaded
âž• 2
here’s what you need to do to override the properties in ktor tests, and it is not nice https://github.com/antonarhipov/ktor-ws-chat/blob/master/src/test/kotlin/com/example/ApplicationTest.kt#L19-L30
👀 1