Use `testcontainers` for integration tests
Currently, Makefile has targets to run Postgres which is then used in integartion tests.
It might be better to use testcontainers (example here), which has the advantage of allowing entirely isolated tests that can be executed in parallel and reduces dependency on the toolchain, simplifying automation.
I'm generally supportive of moving to testcontainers. Here's a pro/con list (largely Claude's work) on migrating from the current Docker Compose approach:
Migration Trade-offs
Pros:
- Parallel test execution - each test package can have its own isolated Postgres
- Self-contained tests - just run
go test, no external Postgres needed - Simpler CI/CD - no setup orchestration
- No port conflicts or leftover databases
Cons:
- ~2-5s startup overhead per container
- Higher resource usage with parallel execution
- More complex test setup code
- Slightly harder debugging (ephemeral container logs)
Given we already have Docker everywhere, the real trade-off is startup overhead + RAM vs parallelization + simpler automation. With ~30 test files, parallel execution likely wins despite per-container overhead.
Worth prototyping to measure actual performance impact.
Basically happy to approve a PR from you if:
- it results in a major simplification in the codebase; OR
- it's demonstrably faster / better devex, e.g. if you can show a benchmark running over the code
Hey @domdomegg, thank you for your reply. I won't be able to pick this up this week, I'll try the next.