Closed sarmbruster closed 1 year ago
You beat me to it! Here's an example application with a failing test - https://github.com/MT-Jacobs/tr-workshop
I case of Gradle being used as build tool this can be resolved by moving the init-script-file from src/test/resources
to src/testResources/resources
.
Oh! Well that's a change in behavior then. I previously had it working fine in the test
directory.
Change of behavior compared to using testcontainers directly in your tests, I guess. The difference is that test resources are not executed in the test sources context: they are isolated in their own process (which is a reason why they work fine with native images).
I definitely had this working before with Test Resources via the test sources context, but since I can't reproduce it in the example repo I provided, I'll chalk it up as it working previously by accident of my private repo configurations.
In any event this can probably be closed as not an issue - the docs in https://github.com/micronaut-projects/micronaut-test-resources/commit/c777980acd25d6f57dc203243fbf802d439d769f clarify this behavior.
Expected Behavior
Assume a file
src/test/resources/db/init.sql
being referred inapplication.yml
asWhen running e.g.
./gradlew test
that file should be applied to the test database.Actual Behaviour
It seems that test-resources server does not inherit the classpath correctly:
Steps To Reproduce
see description in Expected Behaviour
Environment Information
see thread on gitter as well: https://gitter.im/micronautfw/questions?at=6363a25921df5f7a54cfae9d
Example Application
can share privately if necessary
Version
3.7.2