We're using PostgreSQL teams to create a database from a template for every integration test worker (Jest).
This way every worker works on their own database. The speedup was 5x-7x as tests are now running in parallel.
This way every worker works on their own database. The speedup was 5x-7x as tests are now running in parallel.
My team uses a migration framework (in our case Flyway) such that we can easily create completely fresh DBs on a factory fresh(+ user roles) instance of Postgres. We do this for our testing as well. This means the schema tools are always tested as well. Is there a benefit to using templates? They're faster perhaps?
When migration or seed files have changed, rules rebuild the image. That way the price of migration (about 2 minutes for our Django app) isn't paid on every test run.
Creating a DB from template is 2 seconds.