4 ms·
Why not use docker compose, bring up your infra in one container, your application in a second and your tests access it the application from a third.
by codeonline 3y ago
Why not use docker compose, bring up your infra in one container, your application in a second and your tests access it the application from a third.
- jackcviers3 3y agoTestcontainers can use docker-compose: https://java.testcontainers.org/modules/docker_compose/ https://java.testcontainers.org/modules/docker_compose/. Really, you use testcontainers so that you can manage everything for your test with a single build command, instead of running something extra, then running your tests, then shutting down your docker containers. Plus, with it integrated into your test suites, you can run code against your docker containers on setup/teardown, before/after container start, before/after each test, etc.
- imp0cat 3y agoBecause you don't have to muck around with docker-compose. I guess some people might find that more attractive.
- OJFord 3y agoMeanwhile docker compose selling point: 'because you don't have to muck around with testcontainers; I guess some people might find that more attractive'.
- imp0cat 3y agoOh, absolutely! And as the other guy pointed out, docker-compose can be quite reusable when developing locally if you write it right. But at $WORKPLACE we often use pytest-xprocess to start the required app in the same container where the tests run. It's probably the easiest way mostly because a custom wrapper does all the heavy lifting (starts the app, checks that it is running and responding to requests before the tests start, correctly terminates it when tests end).
- LunaSea 3y agoYou'd probably need it for the development environment anyway so you might as well reuse it