Stage 3 · Build
Testing & Release Confidence
Integration Testcontainers
Run PostgreSQL, Redis, and NATS dependencies in Testcontainers with migrations and cleanup hooks.
Why Testcontainers
Integration tests need real databases. Testcontainers spins up Docker containers for PostgreSQL, Redis, and other services. Tests run against real infrastructure without polluting shared environments.
Setup PostgreSQL
Setup Redis
Migrations in Tests
Cleanup Hooks
Parallel Tests
In CI, use docker-compose to start PostgreSQL and Redis before tests. This is faster than Testcontainers for CI pipelines. Use Testcontainers for local development.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.