3 ms·
Because you may want to spin up a new postgres database to test a specific scenario in an automated way. Testcontainers allows you to do that from code, for exa
by callamdelaney 3y ago
Because you may want to spin up a new postgres database to test a specific scenario in an automated way. Testcontainers allows you to do that from code, for example you could write a pytest fixture to provide a fresh database for each test.
- silon42 3y agoIf you need that, sure, but often this will be too expensive (heat my laptop too much).
- perfectspiral 3y agoI don't know about Postgres but a MySQL container can take at least a few seconds to start up and report back as healthy on a Macbook Pro. You can just purge tables on the existing database in between tests, no need to start up a whole new database server each time.
- Rapzid 3y agoYou can also reuse containers with test containers. Now the next question might be "Well why use test containers then if you are reusing containers". Because you can express these dependencies and drive the config programmatically from your code and test harness.