Test
Quick start
Prefer the repository’s containerized Go toolchain so local Go versions don’t matter.
Unit tests (default)
Run all unit tests:
bash
docker run --rm -v "$PWD":/src -w /src golang:1.25.6-alpine sh -c "go test ./..."
If you only changed a specific area, prefer a narrower command first (faster), e.g.:
bash
docker run --rm -v "$PWD":/src -w /src golang:1.25.6-alpine sh -c "go test ./internal/..."
Integration test (optional; requires Docker)
Run the concurrency integration test (testcontainers):
bash
RUN_INTEGRATION=1 docker run --rm -v "$PWD":/src -w /src golang:1.25.6-alpine sh -c "go test ./... -run TestConcurrentReviewCreates_UpdateAggregates"
When tests fail (workflow)
- •Re-run the smallest reproducer:
- •If only one package fails, re-run
go testfor that package. - •If a single test fails, re-run with
-run <TestName>.
- •If only one package fails, re-run
- •Read the failure output and identify:
- •exact failing test name(s)
- •expected vs actual
- •whether the failure is deterministic or flaky
- •Fix the root cause (not the symptom), then re-run:
- •the failing test(s)
- •the broader package
- •finally
go test ./...(unit) and, if relevant, the integration test above
Notes specific to this repo
- •Use
docker compose up -d --buildto start Postgres/Redis/RabbitMQ when you need runtime dependencies, but unit tests should generally not require it. - •Integration tests requiring Docker should be run only when relevant to the change or when explicitly requested.