Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



I 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.


You 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.


If you need that, sure, but often this will be too expensive (heat my laptop too much).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: