integration

Run database-backed Go integration tests against a real Postgres instance.

4|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/reliant-labs/forge --skill integration-reliant-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration
Source: https://github.com/reliant-labs/forge/tree/main/internal/templates/project/skills/forge/testing/integration
Command: npx skills add https://github.com/reliant-labs/forge --skill integration-reliant-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you validate that migrations and data-access code work correctly against a real Postgres database, without polluting normal unit test runs.

Core Features & Use Cases

  • Real database verification: Exercises queries and data layers against the actual schema rather than mocks.
  • Explicit build-tag execution: Ensures integration tests only run when -tags integration (or forge test integration) is provided.
  • Transaction-per-test isolation: Wraps each test in a database transaction that rolls back to prevent cross-test contamination.
  • Use Case: Confirm that sqlc-generated queries match real behavior by running end-to-end query tests that depend on the live database and schema.

Quick Start

Run forge test integration to execute all integration tests with the required integration build tag.

Frequently Asked Questions about integration

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

FAQPage Schema
How do I run Go integration tests against a real Postgres database without affecting unit tests?

Use the //go:build integration build tag to separate database tests, then execute them with forge test integration. This keeps default unit test runs clean while validating queries against a real Postgres instance.

How does transaction-per-test isolation work for database integration tests?

Transaction-per-test isolation wraps each database integration test in its own transaction that rolls back upon completion. This prevents cross-test data contamination in Postgres, ensuring deterministic assertions without manual cleanup.

Can I validate sqlc-generated queries against a live Postgres schema during testing?

Yes, this Skill supports sqlc query validation by running end-to-end query tests against a real Postgres database and live schema, verifying that generated queries match actual database behavior.

Do I need Docker Compose to run Postgres integration tests with Go build tags?

Docker Compose is supported for provisioning the Postgres instance required by integration tests. Proper prerequisites must be met to execute tests using the integration build tag via forge test integration.

What is the best way to verify database migrations work correctly without polluting the normal test suite?

Apply the //go:build integration build tag to migration verification tests. This isolates them from standard unit test runs, ensuring schema migrations are validated against a real Postgres database only when explicitly invoked.

Why are my database-backed Go tests causing cross-test contamination?

Cross-test contamination occurs without transaction-per-test rollback isolation. Wrapping each test in a database transaction that automatically rolls back prevents leftover data from affecting subsequent integration test assertions.