testdock

Create isolated temporary test databases for Go integration testing.

2|Updated Feb 26, 2024
One-click install
npx skills add https://github.com/n-r-w/testdock --skill testdock
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testdock
Source: https://github.com/n-r-w/testdock/tree/main/doc/testdock
Command: npx skills add https://github.com/n-r-w/testdock --skill testdock

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TestDock removes the complexity of building reliable database integration tests by creating isolated temporary databases instead of relying on mocks or shared test data.

Core Features & Use Cases

  • Database-specific helpers: Use dedicated helpers for PostgreSQL, MySQL, MongoDB, or generic SQL drivers.
  • Isolated test environments: Run tests in Docker or against external databases with automatic mode selection.
  • Migration-aware setup: Apply Goose, golang-migrate, or custom migrations during test initialization.
  • Parallel-safe testing: Create independent databases per test so concurrent tests do not conflict.
  • Use case: A Go service team can validate repository logic against a real PostgreSQL instance, seed migrations automatically, and run t.Parallel() safely without shared-state failures.

Quick Start

Ask for a Go test example that uses TestDock to create an isolated PostgreSQL database with migrations applied.

Frequently Asked Questions about testdock

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

FAQPage Schema
How do I create isolated PostgreSQL test databases for Go integration testing?

Isolated PostgreSQL test databases for Go integration testing are created by spinning up temporary instances that apply migrations and support parallel-safe execution. This replaces mocks with real database connections to validate repository logic safely across concurrent tests.

What is the best way to run parallel Go tests without database conflicts?

Running parallel Go tests without database conflicts requires creating independent, isolated temporary databases per test. This parallel-safe testing approach ensures concurrent tests do not encounter shared-state failures when executing simultaneously against real database instances.

Can I use golang-migrate or Goose migrations when setting up a test database?

Yes, you can apply Goose, golang-migrate, or custom migration factories during test database initialization. This migration-aware setup automatically executes your schema changes when the isolated temporary database is created, ensuring your tests run against the correct database structure.

Does this database testing approach work with MongoDB and MySQL in addition to PostgreSQL?

Yes, this database testing approach works with MongoDB and MySQL in addition to PostgreSQL by providing database-specific helpers for each driver. It also supports generic SQL workflows, allowing you to select the appropriate helper based on your specific database driver.

Do I need Docker to run isolated test databases, or can I use an external database?

You do not need Docker exclusively, as the testing framework supports automatic mode switching between Docker and external databases. This allows you to run isolated test databases locally via Docker or point your tests toward an external database instance.