When to use integration tests
Use integration tests to cover behavior across service boundaries, real databases, caches, and storage. These tests catch failures that mocks miss. Integration tests must document the cross-boundary guarantee they protect. Make it clear which production contract would be broken if the test failed, such as transaction rollback, idempotency, permission propagation, cache invalidation, or persistence after restart.Container patterns
Usepkg/testutil/containers for isolated, per-test containers. Helpers register cleanup with t.Cleanup immediately after creating a container, so failed readiness checks don’t leak resources. Run tests that use these helpers through Bazel so schema runfiles are available.
Test harness
Usepkg/testutil when you need a full service graph and seeded data:
Bazel sizing
Integration tests that start containers must usesize = "large". Shared-container tests can use size = "medium".

