News for hackers. Stuff that matters.
Re:Testcontainers by callamdelaney on Wednesday February 28, 2024 @04:45AM (#39535900)
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.
Re:Testcontainers by perfectspiral on Wednesday February 28, 2024 @06:16AM (#39536519)
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.
Re:Testcontainers by Rapzid on Wednesday February 28, 2024 @01:14PM (#39541703)
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.

Re:Testcontainers by silon42 on Wednesday February 28, 2024 @04:56AM (#39535971)
If you need that, sure, but often this will be too expensive (heat my laptop too much).