When running native tests in Quarkus, the application runs in a container. I have functionality that involves reading and writing to the filesystem. Therefore, I must prepare test data before each test run by writing the desired files to the filesystem.
For regular QuarkusTest
, this works fine, as everything runs locally. When running a native QuarkusIntegrationTest
, this obviously will not work. The container running my native image has its own filesystem, and the data that I do prepare in my test runner will end up on the container host machine.
It would be really neat if one could map a volume for integration testing, but as far as I know, this is not possible. Another option is to create a REST API for testing purposes to write and read files. But this would need to be specifically secured.
What would be a feasible way to prepare test data on the filesystem of the app container?
The possibilty to mount a volume for a container test will be available with Quarkus 3.5 https://github.com/quarkusio/quarkus/issues/35864