What problem does it solve?
It solves the pain of flaky and slow integration tests by providing a consistent way to start real external dependencies locally using testcontainers-go, then automatically stop them after the test run.
Core Features & Use Cases
- Use ready-made containers for PostgreSQL, RabbitMQ, Redis, Kafka, and MongoDB via testcontainers-go modules instead of building containers from scratch.
- Standardize integration test bootstrap for both regular Go tests/suites and BDD godog tests so they share the same container lifecycle.
- Enforce correctness and cleanup using context timeouts and tb.Cleanup to guarantee container termination, reducing resource leaks and nondeterminism.
- Handle special cases responsibly by only using GenericContainer/manual setup when modules don’t cover the needed contract, with a short comment explaining why.
Quick Start
Update your integration test to start PostgreSQL (or another service) via the corresponding testcontainers-go module, wrap startup in context.WithTimeout, and register termination with tb.Cleanup so the container stops automatically after the test.