Hacker News new | past | comments | ask | show | jobs | submit login

Wouldn't that just massively, _massively_ slow down your tests, if each test was spinning up its own Postgres container?

I ask because I really like this and would love to use it, but I'm concerned that that would add just an insane amount of overhead to the point where the convenience isn't worth the immense amount of extra time it would take.




A better approach is to spin up one container and a _template_ database before the tests. Apply migrations to that database. Then, each test creates its own database from the template, runs, and drops the database.

Tests can be run in parallel, and they are fast because the database is prepared just once, tests simply make a copy.

We're doing this in my company, I'm happy how it works.





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

Search: