golang-testcontainers

Write Go integration tests with testcontainers-go for PostgreSQL, MySQL, Redis, RabbitMQ, and Kafka.

1|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/baotoq/agent-skills --skill golang-testcontainers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-testcontainers
Source: https://github.com/baotoq/agent-skills/tree/main/skills/golang-testcontainers
Command: npx skills add https://github.com/baotoq/agent-skills --skill golang-testcontainers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing robust integration tests in Go by leveraging real infrastructure components like databases and message queues within Docker containers, eliminating the need for brittle mocks.

Core Features & Use Cases

  • Real Infrastructure Testing: Test your Go applications against actual PostgreSQL, MySQL, Redis, RabbitMQ, and Kafka instances.
  • Idiomatic Go Testing: Integrates seamlessly with Go's standard testing package, using patterns like table-driven tests and t.Cleanup().
  • Use Case: Ensure your data access layer correctly interacts with a PostgreSQL database by running tests against a live, containerized PostgreSQL instance before deploying your application.

Quick Start

Use the golang-testcontainers skill to write integration tests for a Go application that uses PostgreSQL.

Frequently Asked Questions about golang-testcontainers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Go integration tests against a live PostgreSQL database?

To write Go integration tests against a live PostgreSQL database, use testcontainers-go to spin up real Docker containers during your test suite. This approach eliminates brittle mocks by validating your data access layer against an actual database instance using idiomatic Go testing patterns.

What is the best way to test a Go application with Redis and RabbitMQ without mocking?

The best way to test a Go application with Redis and RabbitMQ without mocking is using testcontainers-go. It spins up real infrastructure components in Docker containers, allowing you to execute integration tests against actual caches and message queues seamlessly integrated with Go's standard testing package.

Do I need Docker installed to run testcontainers-go integration tests?

Yes, you need Docker installed and actively running on your machine to execute testcontainers-go integration tests. The framework relies on the Docker daemon to spin up real databases, caches, and message queues as lightweight containers during your Go test execution lifecycle.

How does testcontainers-go integrate with standard Go testing patterns?

Testcontainers-go integrates with standard Go testing patterns by leveraging native features like table-driven tests and t.Cleanup(). This ensures that containerized infrastructure components such as MySQL or Kafka instances are automatically torn down after your integration tests complete execution.

Can I use testcontainers-go to test Kafka integrations in my Go application?

Yes, you can use testcontainers-go to test Kafka integrations in your Go application. It supports spinning up Kafka alongside PostgreSQL, MySQL, Redis, and RabbitMQ in Docker containers, enabling robust end-to-end integration tests for your message queue implementations.