Skip to main content

Testing

The quality gate is a set of make targets that mirror the jobs of .github/workflows/ci.yml, so everything CI does after a push can be run before it. make help lists the targets. The tree has 96 _test.go files outside web/ and docs/; 14 of them carry the integration build tag.

The pyramid as it is​

LayerWhereWhat it provesCommand
Unitinternal/domain/*/*_test.go, internal/application/**Aggregate invariants (departure, schedule, load, volume, network, shared) and the use cases against the in-memory adaptersmake test (go test ./... -race)
Handler and adapterinternal/adapters/inbound/http, inbound/kafka, inbound/mcp, inbound/a2a, cmd/*/*_test.goRouting, problem types, the idempotency middleware, consumers with fake readers, MCP and A2A registries (the tool set is byte-pinned in a golden registry), boot configuration of each binarymake test
Acceptance (godog)features/*.feature: 11 files, 189 scenario definitions, 217 executed. Definitions are the Scenario: and Scenario Outline: lines (git grep -c -E "^[[:space:]]*Scenario( Outline)?:" -- features, an Outline counts once); executed adds one run per Examples row and is the N scenarios line of go test ./features -run TestFeatures -v. Original files (definitions = executed): assignments 13, booking 9, loads 12, pickups 8, schedules 9. Rule files from the documentation-derived wave (definitions / executed): booking_rules 27 / 31, load_rules 26 / 31, pickup_rules 36 / 46, projection_rules 10 / 10, read_rules 14 / 16, schedule_rules 25 / 32Gherkin over the real HTTP API with in-memory repositories; steps in features/steps_*_test.go (the rule files' steps in steps_rules_test.go), runner features/features_test.go (TestFeatures, Strict: true)make bdd
Integration*_integration_test.go with //go:build integration: repositories, the relay, the idempotency middleware, the consumers and the real-wiring test cmd/api/e2e_integration_test.goReal Postgres and Kafka started by testcontainers; no DATABASE_URL, no docker compose, no t.Skip gatemake integration (needs Docker)
Contractinternal/adapters/outbound/repocontractOne behavioural suite for every repository, run against the in-memory adapter (memory_test.go) and the Postgres adapter (postgres_integration_test.go) so the double cannot driftpart of make test and make integration
Coverage gateMakefile coverage90 % statement coverage over internal/domain/... and internal/application/...make coverage
Mutation.gremlins.yamlgremlins v0.6.0 over every internal/domain/<pkg>, one worker, timeout coefficient 30, efficacy and mutant-coverage thresholds both 99 (plain integers: a quoted string is not enforced by gremlins); the measured result in the file (2026-11-15) is 100 % efficacy and mutant coverage for shared, network, departure, schedule, load and volumemake mutation (fast, per package), make mutation-full (exhaustive over ./internal/domain)
Fitnessinternal/architecture/*_test.goThe architecture as executable rules (below)make arch-test
VulnerabilitiesgovulncheckKnown CVEs in dependencies and the standard librarymake vuln
Webweb/npm run lint, npx tsc -b, npm test (vitest), npm run build for the linehaul_mfe console remoteCI job web

Fitness tests​

make arch-test runs go test ./internal/architecture/... -v. The rules include:

  • architecture_test.go: hexagonal dependencies (domain imports nothing from application or adapters; inbound and outbound adapters do not import each other).
  • runtime_no_memory_fitness_test.go: TestRuntimeBinaryHasNoInMemoryAdapters (no cmd/** imports adapters/outbound/memory) and repocontract_fitness_test.go (no binary imports the repository contract), each with a "sensor bites" companion test that proves the rule fails on a bad fixture.
  • mcp_readonly_fitness_test.go (TestMCPServerIsReadOnly), a2a_fitness_test.go (TestA2AAdapterIsReadOnly), mcp_optional_inputs_test.go: the agent surfaces hold only a read interface and optional tool inputs carry omitempty.
  • fitness_test.go: TestNoAuthMiddlewareReintroduced, TestKafkaConsumerGroupNeverHardcodedInline, TestNoEventEnvelopeToggleOrFlatEnvelope, TestKafkaIntegrationTestsUseTestcontainers, TestPostgresIntegrationTestsUseTestcontainers.
  • events_fitness_test.go (TestCloudEventsOnly), catalogue_fitness_test.go (TestEventCatalogueMatchesContract: the published types equal apis/asyncapi.yaml).
  • kafka_writer_topic_fitness_test.go, kafka_writer_acks_fitness_test.go, kafka_dlq_shutdown_fitness_test.go, outbox_relay_cap_fitness_test.go: writer topics and acks, dead-letter calls guarding cancellation, the attempt cap on every relay.
  • no_go_files_at_root_fitness_test.go: no Go file at the repository root.

Make targets​

TargetWhat it runs
make build, make vet, make fmt, make fmt-checkgo build ./..., go vet ./..., gofmt -w ., gofmt -l . must be empty
make lintgolangci-lint run --allow-parallel-runners ./... (v2.14.0 pinned)
make testgo test ./... -race
make coveragethe CI coverage command and the 90 % gate over ./internal/domain/...,./internal/application/...
make bddgo test ./... -run TestFeatures -v
make arch-testgo test ./internal/architecture/... -v
make integrationgo test -tags=integration ./... -race -count=1 (Docker)
make mutation, make mutation-fullgremlins per domain package / over ./internal/domain
make vulngovulncheck ./...
make checkfmt-check vet build lint test: the pre-push gate (lefthook runs it on git push)
make check-allcheck + coverage + arch-test + bdd
make check-fastfmt-check vet arch-test plus the tests of the packages changed against HEAD (the agent Stop hook)
make guide-lint, make harness-testlint the agent guides; unit-test the agent hooks

Pre-commit (lefthook) runs fmt-check, vet and lint; install the hooks with lefthook install.

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

The workflow runs on pushes and pull requests to main and develop, weekly (Monday 06:00 UTC) and on manual dispatch. "Push and pull request" below means those branches.

JobRunsWhen
lintgolangci-lintpush and pull request
guide-lintscripts/harness/guide_lint.py, test_hook.pypush and pull request
complexitygocyclo report (informational above 10, gate 15)push and pull request
testbuild, vet, make coverage (90 % gate, coverage artefact)push and pull request
bddgo test ./... -run TestFeatures -vpush and pull request
integrationgo test -tags=integration ./... -race -count=1push and pull request
mutation-fastgremlins over every domain packagepush and pull request
mutationgremlins over ./internal/domain, opens or closes a harness:red issueweekly schedule and manual dispatch
driftdead code, stale go.mod entries, unused frontend exports, coverage quality (advisory)weekly schedule and manual dispatch
api-lintSpectral on apis/openapi.yaml and apis/asyncapi.yamlpush and pull request
vulngovulncheck ./...push and pull request
helm-lintct lint --charts charts/linehaul-transportation and the selector testpull request
chart-testscharts/linehaul-transportation/tests/render_test.sh, test_service_selectors.pypush and pull request
arch-testgo test ./internal/architecture/... -vpush and pull request
webnpm ci, lint, tsc -b, vitest, build in web/push and pull request
docker-publishbuild and push the image to GHCR, cosign signature, SBOMpush to main
releasenext version, retag the image, publish the chart, GitHub releasepush to main

The documentation site is built by its own workflow, .github/workflows/docs.yml (build on pull request, deploy on push to main).

Writing tests here​

  • A new domain rule gets a unit test and must keep mutation efficacy above 99 %; a surviving mutant usually means a missing assertion, not a missing line.
  • A new REST behaviour gets a scenario in the matching features/*.feature and, if it touches persistence, a case in the repository contract so both adapters are held to it.
  • A new published event type must appear in apis/asyncapi.yaml or TestEventCatalogueMatchesContract fails.
  • Integration tests must boot their own containers; a test that needs an environment variable or skips itself fails TestPostgresIntegrationTestsUseTestcontainers.