Parallel test processes sharing one database, and the transaction-per-test isolation that stops working under concurrency.
the problem: a transaction per test isolates that test
from its own writes and not from another process's.
process 1 BEGIN; INSERT customer(email='[email protected]')
process 2 BEGIN; INSERT customer(email='[email protected]')
→ duplicate key, in a test that is correct
the fix: one database per process.
app_test_1 .. app_test_8, created once, schema loaded
from a dump rather than from 188 migrations.
Loading the schema from a dump rather than migrating is what makes eight databases affordable — eight times 188 migrations is four minutes of setup and eight times one dump is nine seconds. The dump has to be regenerated when a migration is added, which is a step in the same job and fails loudly when it is stale.