Skip to main content

Testing

Source: Makefile, .github/workflows/ci.yml, .gremlins.yaml, features/, internal/architecture/, internal/testing/, charts/dock-scheduling/tests/.

Counts below come from grep over the tree on develop, not from a test run: about 480 func Test... in *_test.go under internal/, cmd/ and features/, of which 55 sit in 25 integration-tagged files and 37 are architecture fitness tests.

The pyramid​

LayerWhereWhat it provesNeeds
Unit (domain)internal/domain/{dockappointment,dockcalendar,shared}/*_test.goAggregate invariants, state machine, window and overlap rules, availability, snapshots.nothing
Unit (application)internal/application/usecases/*_test.goUse cases against the in-memory doubles: booking checks, change flows, fact consumption, idempotent wrapper, initiator attribution.nothing
Adapter unitinternal/adapters/**/*_test.go, cmd/*/main_test.gohttptest REST handlers and problem mapping, idempotency middleware, readiness, CloudEvents encoder/decoder, Kafka consume loop with fake readers, relay with a fake store, MCP tools, telemetry, boot configuration of every binary, sweep retry logic (cmd/sweep/sweep_test.go).nothing
BDD acceptancefeatures/*.feature + *_steps_test.goThe behaviour through the REST router with the in-memory doubles. 12 feature files, 184 Scenario and Scenario Outline definitions, 286 scenarios executed once the Examples rows are expanded (286 scenarios (286 passed) from go test ./features -run TestFeatures -count=1 -v). Definitions / executed: door_booking 10 / 10, yard_facts 10 / 13 (one Outline for the arrival status), door_calendar 9 / 9, asn_single_appointment 7 / 7, no_show_sweep 7 / 7, rest_contract 6 / 6, carrier_registry 15 / 15, standard_vocabulary 11 / 11, and the four files that pin the rules of the Dock Scheduling documentation: booking_rules 28 / 49 (booking and reschedule), lifecycle_rules 22 / 44 (states, cancel, ETA, check-in, no-show sweep), yard_rules 21 / 34 (yard facts and their policies), calendar_rules 38 / 81 (settings, operating hours, closures, doors, availability). Runner features/features_test.go (TestFeatures, godog).nothing
Integrationfiles with //go:build integration in cmd/api, cmd/mcp, cmd/projector, cmd/reports, internal/adapters/inbound/kafka, .../outbound/{analyticsstore,outbox,postgres}The real Postgres and Kafka adapters, migrations, the outbox relay (including the attempt cap), consumers end to end, the real run entrypoints started and stopped. Every test boots its own containers via testcontainers (internal/testing/{pgtest,kafkatest}); TestPostgresIntegrationTestsUseTestcontainers and TestKafkaIntegrationTestsUseTestcontainers forbid a DATABASE_URL gate or a t.Skip.Docker
Contractinternal/testing/repocontract (run against the memory and Postgres adapters), internal/adapters/inbound/http/reports_contract_test.go (routes and responses against apis/openapi-reports.yaml), TestEventCatalogueMatchesContract (ADR 0004 catalogue against apis/asyncapi.yaml)The two repository implementations behave the same; the reports router matches its spec; the event catalogue matches the AsyncAPI.Docker for the Postgres half
Mutation.gremlins.yaml, make mutation, make mutation-fullWhether the domain tests assert rather than merely execute. Measured (gremlins v0.6.0, one worker, timeout coefficient 30): dockappointment 100 % efficacy (106 killed, 0 lived), dockcalendar 100 % (104 killed, 0 lived), shared 100 % (14 killed, 0 lived). Thresholds: efficacy 95, mutant coverage 95 (gremlins fails at or below the threshold).gremlins
Fitnessinternal/architecture (37 tests)See below.nothing
Chartcharts/dock-scheduling/tests/render_test.sh, test_service_selectors.py, test_sweeps_cronjob.py: mandatory values refuse to render, every env var is rendered, no *_MODE, secret for the DSN, hardening, grace period, each Service selects exactly one Deployment, the sweep retry budget fits activeDeadlineSeconds.helm, PyYAML

There is no end-to-end suite across services and no load test; the autoscaling note in the chart says N>1 api replicas have not been load-tested.

Fitness tests (internal/architecture)​

TestGuards
TestHexagonalArchitectureDependency direction (arch-go): the domain depends on nothing internal except the domain, and the layer rules of the hexagon.
TestRuntimeBinaryHasNoInMemoryAdaptersNo cmd/ imports the memory adapter.
TestNoGoFilesAtRepoRootNo .go at the root.
TestCloudEventsOnly, TestNoEventEnvelopeToggleOrFlatEnvelopeCloudEvents 1.0 on every message; no flat envelope or toggle.
TestEventCatalogueMatchesContractThe published event catalogue equals the AsyncAPI.
TestKafkaConsumerGroupNeverHardcodedInline, TestReplayConsumersSetCommitIntervalGroup ids come from the environment; commit behaviour.
TestKafkaWritersSetRequiredAcks, TestKafkaWriterTopicNotSetTwiceacks=all; the topic is set per message, not on the writer too.
TestDeadLetterCallsGuardCancellationDead-letter calls do not hang shutdown.
TestOutboxRelaysPassAttemptCapEvery relay a cmd/ builds passes WithMaxAttempts.
TestNoAuthMiddlewareReintroducedNo auth middleware on REST or MCP.
TestMCPAdapterDependencyRule, TestEveryMCPToolDeclaresAuthority, TestMCPWriteToolsAreAtLeastL3, TestMCPServerOffersResourceAndPrompt, TestMCPOptionalToolInputsCarryOmitemptyMCP structure, authority levels, resource and prompt present, optional inputs optional.
TestPostgresIntegrationTestsUseTestcontainers, TestKafkaIntegrationTestsUseTestcontainersIntegration tests are self-contained.
TestA2ASkillsDeclareAuthority, TestAgentAdapterSkipRulesA2A skill rules; this repo has no A2A server, so they skip.
*SensorBites / *SensorFailsOnBadFixtures testsEach scanning sensor is proven to fail on a bad fixture.

Make targets​

make test, make coverage (90 % gate on domain and application), make bdd, make arch-test, make integration, make mutation, make mutation-full, make lint, make vuln, make check, make check-all; the full list with what each runs is in the Quickstart. The agent harness adds make check-fast, make guide-lint and make harness-test.

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

Triggers: push and pull request on main and develop, a weekly schedule (Monday 06:00 UTC, mutation and drift jobs only) and manual dispatch.

JobWhat it runs
lintgolangci-lint.
guide-lintscripts/harness/guide_lint.py and test_hook.py: the agent guides and hooks.
complexitygocyclo report (informational, gate 15).
file-lengthFile length of the Go files a PR touches (blocking).
testmake coverage with the 90 % gate, uploads the profile.
bddgo test ./... -run TestFeatures -v.
integrationgo test -tags=integration ./... -race -count=1.
mutation-fastgremlins over every domain package.
mutationExhaustive gremlins unleash ./internal/domain --workers 1 --timeout-coefficient 30; scheduled or manual, opens a harness:red issue on failure.
driftScheduled or manual: dead code (deadcode), go mod tidy -diff, coverage-quality check.
api-lintSpectral on apis/openapi.yaml, apis/openapi-reports.yaml and apis/asyncapi.yaml (fail on warn).
vulngovulncheck ./... (installed at @latest).
chart-testsEvery charts/dock-scheduling/tests/*.sh and test_*.py.
arch-testgo test ./internal/architecture/... -v.
helm-lintPRs only: ct lint on the chart.
trivy-scanPRs only: builds the image and scans it.
docker-publishPush to main, after lint, complexity, test, bdd, integration, mutation-fast, vuln, api-lint and arch-test: build and push to ghcr.io/iqvo, cosign sign, SBOM attest.
releasePush to main, after docker-publish: tag the image, package and publish the chart.

The documentation site has its own workflow, .github/workflows/docs.yml (build on pull requests, deploy to GitHub Pages on push to main).

Adding a test​

  1. Pure rule: add a table test next to the aggregate (internal/domain/...) and check make mutation still reports no survivors.
  2. A new behaviour visible over REST: add a scenario to the matching features/*.feature and, if needed, a step in the features/*_test.go step files.
  3. A new adapter behaviour that needs a real database or broker: an integration test under //go:build integration, using pgtest or kafkatest; add the case to repocontract when it is a repository behaviour both adapters must share.
  4. A new event or route: update apis/asyncapi.yaml or apis/openapi.yaml; the catalogue and contract tests will tell you what else moves.