Summary
t.Parallel() adoption is partial — only pkg/exchange/{auto,exchange,reshape}_test.go, providers/aws/services/ec2/client_test.go, and internal/api/validation_test.go have been audited and parallelized. Other packages keep sequential execution because each needs a per-test-file shared-state audit before it's race-safe to parallelize.
Captured in: known-issues.md → "Outstanding follow-ups" → "t.Parallel() adoption for remaining packages".
Current state
Adoption complete:
pkg/exchange/{auto,exchange,reshape}_test.go
providers/aws/services/ec2/client_test.go
internal/api/validation_test.go
Pending audit + parallelization (each carries shared-state risk):
internal/api/ other test files — handler fixtures + shared mocks; not race-safe without review.
internal/config/*_test.go integration tests — share a Postgres container; cannot naively parallelize.
internal/server/app_test.go — uses package-level vars (runMigrations, migrationsTimeout) that are not race-safe.
- Any test file using
os.Setenv / t.Setenv for process-wide state — needs verification that the variable scope is per-test (Go ≥1.17 t.Setenv is correct).
Why this matters
go test ./... for the project currently runs each package sequentially. Per-package parallelism would meaningfully reduce CI wall-clock without materially changing test design. Expected speedup is incremental (a few minutes off the suite) but compounds across CI runs.
Steps to verify the gap
grep -rL "t.Parallel" $(find . -name "*_test.go" | xargs grep -l "func Test" | grep -v vendor) | head
# Lists test files that currently never call t.Parallel
Proposed approach
Per-package incremental audit commits, NOT a single sweeping change:
- Pick one package at a time (start with
internal/api/ test files that don't touch the shared Postgres container).
- Audit each test for:
os.Setenv (use t.Setenv instead), package-level fixtures, shared mocks (move to per-test setup), shared file paths.
- Add
t.Parallel() to test functions and (where needed) sub-tests.
- Run
go test -race -count=2 ./<pkg>/... to confirm no flakes.
- Commit per package with
chore(tests): parallelize <pkg>.
For integration tests sharing a Postgres container: use sub-test t.Run with t.Parallel() only after introducing per-test-schema isolation, OR keep them sequential and parallelize only unit-level tests within the same package.
References
- Known-issue doc:
known-issues.md → "t.Parallel() adoption for remaining packages".
- Already-done examples:
pkg/exchange/auto_test.go, internal/api/validation_test.go.
Severity
Low — quality-of-life CI improvement, no functional impact.
Effort
Variable per package — small for unit-only packages (~30 min audit + parallelize), larger for integration-test packages (require schema-isolation or stay sequential). Best handled as a series of small per-package commits.
Summary
t.Parallel()adoption is partial — onlypkg/exchange/{auto,exchange,reshape}_test.go,providers/aws/services/ec2/client_test.go, andinternal/api/validation_test.gohave been audited and parallelized. Other packages keep sequential execution because each needs a per-test-file shared-state audit before it's race-safe to parallelize.Captured in:
known-issues.md→ "Outstanding follow-ups" → "t.Parallel() adoption for remaining packages".Current state
Adoption complete:
pkg/exchange/{auto,exchange,reshape}_test.goproviders/aws/services/ec2/client_test.gointernal/api/validation_test.goPending audit + parallelization (each carries shared-state risk):
internal/api/other test files — handler fixtures + shared mocks; not race-safe without review.internal/config/*_test.gointegration tests — share a Postgres container; cannot naively parallelize.internal/server/app_test.go— uses package-level vars (runMigrations,migrationsTimeout) that are not race-safe.os.Setenv/t.Setenvfor process-wide state — needs verification that the variable scope is per-test (Go ≥1.17t.Setenvis correct).Why this matters
go test ./...for the project currently runs each package sequentially. Per-package parallelism would meaningfully reduce CI wall-clock without materially changing test design. Expected speedup is incremental (a few minutes off the suite) but compounds across CI runs.Steps to verify the gap
Proposed approach
Per-package incremental audit commits, NOT a single sweeping change:
internal/api/test files that don't touch the shared Postgres container).os.Setenv(uset.Setenvinstead), package-level fixtures, shared mocks (move to per-test setup), shared file paths.t.Parallel()to test functions and (where needed) sub-tests.go test -race -count=2 ./<pkg>/...to confirm no flakes.chore(tests): parallelize <pkg>.For integration tests sharing a Postgres container: use sub-test
t.Runwitht.Parallel()only after introducing per-test-schema isolation, OR keep them sequential and parallelize only unit-level tests within the same package.References
known-issues.md→ "t.Parallel() adoption for remaining packages".pkg/exchange/auto_test.go,internal/api/validation_test.go.Severity
Low — quality-of-life CI improvement, no functional impact.
Effort
Variable per package — small for unit-only packages (~30 min audit + parallelize), larger for integration-test packages (require schema-isolation or stay sequential). Best handled as a series of small per-package commits.