testcontainers docker-compose in sub dir

375 views Asked by At

I have a java, multi maven project layout along the lines of:

app
- src
- pom.xml
service
- src
- pom.xml
integration-tests
- src
local-setup
pom.xml

I want to run a test in integration-tests module, using DockerComposeContainer and point it at a compose file in local-setup. This gives an error:

.FileNotFoundError: [Errno 2] No such file or directory: '/Users/damienburke/workspace/requestlogidentityconsumer/Requestlogidentityconsumer-integration-tests/../local-setup/docker-compose-test-1.yml'

Interestingly, if i just give a bad file, i get a file not found exception.

Caused by: java.io.FileNotFoundException: File '../local-setup/docker-compose-test-1-bad.yml' does not exist
    at org.testcontainers.shaded.org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:297)
    at org.testcontainers.containers.ParsedDockerComposeFile.<init>(ParsedDockerComposeFile.java:36)
    ... 74 more

I have no bother referring to file in project root dir, e.g.:

../docker-compose.yaml

but again - its when i want to go into a sub-dir is where the problem is, e.g.

../local-setup/docker-compose.yaml

I also confirmed docker-compose works when going into a diff sub dir -

docker-compose  -f ../local-setup/docker-compose.yml up -d

Thanks!

0

There are 0 answers