Skip to main content

Testing

Every CI sensor has a make target, so the feedback CI gives after a push is available before it. make help lists them all.

The pyramid as it is​

LayerWhereWhat it provesRuns with
Unit, domaininternal/domain/{itemprice,quote,schedule,tax,shared}/*_test.goInvariants: sale below list, non-overlapping windows, quote arithmetic, version rules, id and prefix validationmake test
Unit, applicationinternal/application/usecases/*_test.goEach use case against the in-memory test doubles: outbox rows, inbox dedupe, retry on concurrent-update, quote metricsmake test
Unit, adaptersinternal/adapters/**/**_test.go, cmd/api/*_test.go, cmd/a2a/*_test.goHTTP routes and problem mapping (httptest), idempotency, readiness gate, consumer loop (retry, dead letter, tracing), CloudEvents encoder against golden files, outbox relay, telemetry, boot configuration, A2A skills and cardmake test
Godog features (BDD)features/*.feature, wiring in internal/bdd/Behaviour through the real HTTP router on in-memory doublesmake bdd
Repository contractinternal/adapters/outbound/repocontract/One suite run against both the in-memory store (memory_test.go) and Postgres (repositories_integration_test.go), so the doubles cannot drift from the real repositoriesmake test, make integration
Integration9 files tagged integrationReal Postgres and Kafka through testcontainers: repositories, migrations, outbox claim and relay, outbox trace headers, cmd/api wiring, readiness, an end-to-end test, and cmd/a2a on real Postgresmake integration
Fitness (architecture)internal/architecture/Structural rules as executable tests, belowmake arch-test
Mutation.gremlins.yaml, make mutationTests assert rather than merely execute, on internal/domain/*make mutation

Godog features​

15 feature files, 127 Scenario and Scenario Outline definitions; with the Examples rows expanded the runner reports 170 scenarios (170 passed) (go test ./internal/bdd -run TestFeatures -count=1 -v).

FilesDefinitionsExecuted
the six acceptance files: item_price (6), sales (5), price_quote (5), policies (5), api_idempotency (7), reads_and_tax (4)3232
item_price_rules1516
sale_window_rules1421
catalogue_feed_rules77
charge_schedule_rules914
tax_table_rules1015
quote_pricing_rules1738
quote_lifecycle_rules88
api_contract_rules1216
readiness_rules33

The nine *_rules.feature files pin the rules of the Pricing documentation and of ADR 0002 and the troubleshooting page (boundaries, caps, state edges, the clock-driven policies, the REST write rules and readiness). The runner is TestFeatures in internal/bdd/features_test.go (steps in steps_given_test.go, steps_when_test.go, steps_then_test.go, steps_wave2_test.go, steps_rules_test.go); there are no Go files at the repository root.

Contract tests​

Three contracts are pinned in tests rather than prose:

  • The HTTP surface against apis/openapi.yaml (Spectral lint in the api-lint job, route and problem tests in internal/adapters/inbound/http).
  • The wire format of every published event: internal/adapters/outbound/kafka compares the CloudEvents bytes with testdata/*.golden.json exactly (ItemPriceChanged, ItemPriceChangedAtListPrice, ItemPriceWithdrawn, DeliveryChargeScheduleChanged, TaxTableChanged, PriceQuoteIssued); rewrite them with the -update flag only for a deliberate change.
  • TestEventCatalogueMatchesContract checks the event types in code against apis/asyncapi.yaml.

Fitness tests​

internal/architecture/ holds these tests (each sensor also has a "bites" test proving it fails on a bad fixture):

TestRule
TestHexagonalArchitecture (arch-go)The domain imports no outer layer; adapters do not reach sideways into siblings
TestRuntimeBinaryHasNoInMemoryAdapterscmd/** never imports the in-memory adapters
TestNoGoFilesAtRepoRootGo files live under cmd/, internal/, features/
TestEventCatalogueMatchesContractEvent catalogue equals apis/asyncapi.yaml
TestCloudEventsOnly, TestNoEventEnvelopeToggleOrFlatEnvelopeEvery Kafka message is a CloudEvents 1.0 envelope; no toggle or flat envelope
TestKafkaConsumerGroupNeverHardcodedInlineConsumer groups come from the environment
TestReplayConsumersSetCommitIntervalOffsets are committed explicitly after handling
TestKafkaWritersSetRequiredAcks, TestKafkaWriterTopicNotSetTwiceWriters use RequireAll; topic is set on the writer or the message, never both
TestDeadLetterCallsGuardCancellationDead-letter publishes guard against shutdown cancellation
TestOutboxRelaysPassAttemptCapEvery cmd/* that builds a relay passes the attempt cap
TestNoAuthMiddlewareReintroducedNo auth middleware under internal/adapters/inbound
TestPostgresIntegrationTestsUseTestcontainers, TestKafkaIntegrationTestsUseTestcontainersIntegration tests boot their own containers, no DATABASE_URL gate or t.Skip
TestA2AAdapterDependsOnlyInward, TestNothingDependsOnTheA2AAdapter, TestNoOutboundA2AClient, TestA2AAgentIsReadOnly, TestA2ABinaryHasNoKafkaOrRelayThe A2A adapter reads only, calls no one, and cmd/a2a has no Kafka or relay

The package also carries the fleet MCP sensors: TestMCPAdapterDependencyRule, TestMCPOptionalToolInputsCarryOmitempty, the authority sensors (every tool and A2A skill declares an authority level) and TestMCPServerIsReadOnly, TestMCPBinaryHasNoKafkaOrRelay and TestMCPSensorsBite (the MCP adapter and cmd/mcp name query use cases only and cmd/mcp has no Kafka or relay). The adapter's own tests add the pinned tool registry golden, the surface (1 resource, 1 prompt) and stateless transport tests.

Mutation testing​

.gremlins.yaml sets one worker, a timeout coefficient of 30, an efficacy threshold of 95 and a mutant-coverage threshold of 99, written as plain numbers (a quoted threshold is read as 0 by gremlins v0.6.0 and never fails). The efficacy gate sits just below the lowest measured package (itemprice, 95.35 on 2026-11-15; quote 100.00, schedule 100.00, shared 100.00, tax 96.49). The four surviving mutants are equivalent and listed in MUTATION.md. make mutation loops gremlins over every directory under internal/domain/ (so a new domain package is gated as soon as it exists); make mutation-full runs ./internal/domain in one go.

Make targets​

TargetWhat it runs
make buildgo build ./...
make vetgo vet ./...
make fmt / make fmt-checkgofmt -w . / fail if gofmt -l . is non-empty
make lintgolangci-lint run --allow-parallel-runners ./... (v2.14.0)
make testgo test ./... -race (unit, httptest, godog; no database)
make coveragego test ./... -race -coverprofile=coverage.out -coverpkg=./internal/domain/...,./internal/application/..., then the 90% gate
make bddgo test ./... -run TestFeatures -v
make arch-testgo test ./internal/architecture/... -v
make integrationgo test -tags=integration ./... -race -count=1 (Docker only; not part of check)
make mutation / make mutation-fullgremlins per domain package / on ./internal/domain
make vulngovulncheck ./...
make checkfmt-check vet build lint test (the pre-push hook)
make check-allcheck + coverage + arch-test + bdd
make check-fastfmt-check vet arch-test and the tests of changed packages (agent Stop hook)
make guide-lint / make harness-testAgent-guide lint / unit tests of the agent hooks

Hooks: lefthook.yml runs fmt-check, vet, lint at pre-commit and make check at pre-push.

CI jobs​

.github/workflows/ci.yml runs on pushes to main and develop, on pull requests to them, weekly (Monday 06:00 UTC, the mutation job only) and on manual dispatch.

JobWhat it does
lintgolangci-lint v2.14.0
guide-lintscripts/harness/guide_lint.py and test_hook.py; advisory (continue-on-error)
complexitygolangci-lint restricted to gocyclo,gocognit,cyclop,funlen,nestif, plus an informational gocyclo report
testgo build, go vet, then make coverage (90% gate over domain and application)
bddgo test ./... -run TestFeatures -v
integrationgo test -tags=integration ./... -race -count=1 (testcontainers)
mutation-fastgremlins over every internal/domain/* package; blocking
mutationexhaustive gremlins on ./internal/domain; only on schedule and manual dispatch, opens or closes a harness:red issue
api-lintSpectral on apis/openapi.yaml and apis/asyncapi.yaml, --fail-severity=warn
vulngovulncheck ./...
helm-lintpull requests only: ct lint and helm lint with each ci/*-values.yaml
chart-testsevery charts/pricing/tests/*.sh and test_*.py; a test that prints SKIP fails
arch-testgo test ./internal/architecture/... -v
docker-publishpush to main only, after the jobs above except the chart ones: builds and pushes ghcr.io/iqvo/pricing, cosign-signs it, attaches an SBOM
releasepush to main only: tags vX.Y.Z, tags the image, packages and pushes the chart, creates the GitHub release

The documentation site has its own workflow, .github/workflows/docs.yml (Docs): it builds on pull requests and deploys on pushes to main. This repository's ci.yml has no docs-api-drift job; regenerate the REST pages with npm run gen-api-docs after a change to apis/openapi.yaml and commit the result.