x-testcontainers-go
OfficialSpin up real services safely in Go tests.
Software Engineering#integration testing#database#go#cleanup#testcontainers-go#docker containers#bdd godog
Authorpure-golang
Version1.0.0
Installs0
System Documentation
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.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: x-testcontainers-go Download link: https://github.com/pure-golang/level85/archive/main.zip#x-testcontainers-go Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.