Skip to main content

Testing

The pyramid as it is​

LayerWhereCount todayNeeds
Unit*_test.go beside the code in internal/domain/{shared,label,journey}, internal/application/*, the adapters and cmd/*the bulk of the suitenothing
Behaviour (godog / Gherkin)features/*.feature, runner features/features_test.go (TestFeatures), steps beside it14 feature files, 134 scenario definitions, 196 executed with the Examples rows (original files: issue_label 9, journey 11, silence 5, open_host 5, void_label 4, eta_window 5, consumed_arrivals 2, ship_to_retention 2, issue_label_edges 1 = 44, each executed once; rule files, all tagged @rules, definitions / executed: journey_rules 31 / 58, label_rules 20 / 34, silence_rules 10 / 21, stop_events_rules 21 / 29, retention_rules 8 / 10). BDD_TAGS=@rules runs only the rule files; unset runs everything. Definitions are git grep -c -E "^[[:space:]]*Scenario" -- features; executed is the N scenarios line of go test ./features -run TestFeatures -vnothing; runs on the in-memory doubles
Repository contractinternal/adapters/outbound/repocontractone case table run against BOTH the memory doubles (memory_test.go) and Postgres (repositories_integration_test.go)Docker for the Postgres run
Integration (-tags=integration)12 *_integration_test.go files: cmd/api/e2e_integration_test.go (real wiring of the entry point), cmd/mcp/main_integration_test.go, cmd/a2a/main_integration_test.go, internal/adapters/inbound/http/{main,idempotency}_integration_test.go, internal/adapters/outbound/outbox/{main,relay,relay_cap}_integration_test.go, internal/adapters/outbound/postgres/{main,repositories,housekeeping,outbox_trace}_integration_test.goDocker. Each test boots its own Postgres and Kafka with testcontainers (internal/testing/pgtest, internal/testing/kafkatest); there is no DATABASE_URL, no compose file and no skip gate
Contractapis/openapi.yaml and apis/asyncapi.yaml linted by Spectral (.spectral.yaml, .spectral.asyncapi.yaml); TestEventCatalogueMatchesContract ties the AsyncAPI to ADR 0004; TestConsumedTypesAreDocumented ties consumed types to ADR 0003; internal/adapters/inbound/mcp/testdata/tool_registry.golden.json pins the MCP tool registry; internal/adapters/inbound/a2a/card_test.go pins the Agent Cardnothing, plus Spectral in CI
Mutationgremlins over every internal/domain/* package, configuration in .gremlins.yamlefficacy and mutant-coverage thresholds both 90gremlins v0.6.0
Fitness (architecture)internal/architecture14 files, 38 test functions, each guard paired with a "sensor bites" test that proves it fails on a bad fixturenothing
Web remoteweb/src/**/*.test.ts(x) with Vitestconsole screens, API client, configNode 22, warehouse-ui-kit checked out next to the repo
Harnessscripts/harness/test_hook.py, test_repo_lint.py, test_red_issue.pyagent hooks and repo lintPython 3

Fitness tests​

internal/architecture guards the design with executable rules:

  • TestHexagonalArchitecture (domain imports nothing from application or adapters; application imports no adapter), TestMCPAdapterDependencyRule, TestMCPServerIsReadOnly, TestA2AAdapterDependencyRule, TestA2AServerIsReadOnly, TestA2AHasNoOutboundClient.
  • TestRuntimeBinaryHasNoInMemoryAdapters: nothing under cmd/ imports internal/adapters/outbound/memory.
  • TestNoGoFilesAtRepoRoot: godog and everything else lives in subdirectories.
  • TestNoAuthMiddlewareReintroduced: no authentication in REST, MCP or A2A.
  • TestCloudEventsOnly and TestNoEventEnvelopeToggleOrFlatEnvelope: every Kafka message is a CloudEvent in structured mode.
  • TestEventCatalogueMatchesContract, TestConsumedTypesAreDocumented: events, AsyncAPI and ADR 0003/0004 agree.
  • TestContractsCarryNoShipToField: no OpenAPI or AsyncAPI schema may carry a ship-to address field.
  • TestKafkaWritersSetRequiredAcks, TestKafkaWriterTopicNotSetTwice, TestKafkaConsumerGroupNeverHardcodedInline, TestReplayConsumersSetCommitInterval, TestDeadLetterCallsGuardCancellation, TestOutboxRelaysPassAttemptCap: Kafka and outbox wiring rules.
  • TestKafkaIntegrationTestsUseTestcontainers, TestPostgresIntegrationTestsUseTestcontainers: integration tests never depend on an ambient database or broker.
  • TestMCPOptionalToolInputsCarryOmitempty: optional MCP tool inputs are optional in the JSON schema.

Run them with make arch-test.

Make targets​

TargetCommandNotes
make checkfmt-check vet build lint testthe pre-commit and pre-push gate (lefthook)
make testgo test ./... -raceunit, httptest and godog, no Docker
make coveragego test ./... -race -coverprofile=coverage.out -coverpkg=./internal/domain/...,./internal/application/...fails below 90%
make bddgo test ./... -run TestFeatures -vgodog scenarios
make arch-testgo test ./internal/architecture/... -vfitness tests
make integrationgo test -tags=integration ./... -race -count=1Docker required; not part of check
make mutationgremlins on each internal/domain/* packagefast blocking gate
make mutation-fullgremlins on ./internal/domain with --workers 1 --timeout-coefficient 30exhaustive, scheduled in CI
make vulngovulncheck ./...needs govulncheck
make check-allcheck coverage arch-test bddrun before pushing
make check-fastfmt-check vet arch-test plus the packages changed against HEADagent Stop hook
make guide-lint, make harness-testagent-guide lint and hook testsharness sensors

Chart tests are not Make targets: run bash charts/shipping-and-tracking/tests/render_test.sh and python3 charts/shipping-and-tracking/tests/test_service_selectors.py (needs helm and PyYAML).

CI jobs (.github/workflows/ci.yml)​

JobWhat it runsBlocks docker-publish
lintgolangci-lint v2.14.0yes
guide-lintscripts/harness/guide_lint.py, test_hook.py; continue-on-errorno
complexitygocyclo, gocognit, cyclop, funlen, nestif through golangci-lint plus an informational gocyclo reportyes
testbuild, vet, make coverage (90% gate), uploads coverage.outyes
bddgo test ./... -run TestFeatures -vyes
integrationgo test -tags=integration ./... -race -count=1yes
mutation-fastgremlins on every domain packageyes
mutationexhaustive gremlins, on schedule or manual dispatch; opens or closes a harness:red issueno
driftdead code, go mod tidy -diff, knip on web/, coverage quality; weekly, advisoryno
api-lintSpectral on both specs, fail on warningyes
vulngovulncheckyes
arch-testfitness testsyes
helm-lintct lint and test_service_selectors.py, pull requests onlyno
chart-testsevery charts/shipping-and-tracking/tests/*.sh and test_*.py; a test that prints SKIP fails the jobno
webnpm ci, lint, tsc -b, tests and build of web/no
docker-publish, releaseimage, signature, SBOM, Helm chart and GitHub release; push to main onlyn/a

The docs build is its own workflow, .github/workflows/docs.yml (build on pull request, deploy on push to main). There is no docs-api-drift job in ci.yml; the generated reference under docs/docs/api-reference/rest is regenerated with npm run gen-api-docs from docs/.