phase 1 core platform

Phase 1 — Go Test Architecture

Hand-written test layout for IBEX Harness Phase 1 (auth + proxy). Generated protobuf code is out of scope for the coverage gate; contract tests live beside `.proto` sources.

Phase 1 — Go Test Architecture

Hand-written test layout for IBEX Harness Phase 1 (auth + proxy). Generated protobuf code is out of scope for the coverage gate; contract tests live beside .proto sources.

Layout

ibex-harness/
├── packages/*/              # Unit tests colocated (*_test.go)
├── packages/proto/          # Contract tests ONLY (auth_contract_test.go, …)
├── packages/proto/gen/go/   # Generated — no mechanical tests; excluded from gate
├── services/*/
│   ├── internal/*/          # Unit tests colocated
│   ├── *_integration_test.go  # //go:build integration
│   └── proxy_security_sec*.go # SEC matrix (integration)
└── infra/testing/testutil/  # Shared factories (SeedOrganization, SeedToken, …)

Pyramid (this project)

LayerShareFocus
Unit60–65%Token parse, permissions, validation, apierror, middleware with fakes
Integration30–35%Postgres RLS, proxy→auth, Redis RPM, SEC matrix
E2E~5%make dev-smoke; future k6

Mock boundaries

MockReal
gRPC AuthServiceClient at proxy boundaryPostgres for RLS
miniredis for unit RPMtoken.Validator DB lookup
Internal domain logic under test

Fixture inventory (infra/testing/testutil)

HelperPurpose
SeedOrganizationOrg row via service account
SeedUserUser in org
SeedAgent / SeedAgentWithStatusAgent lifecycle
SeedToken / token_fixtures.goPAT with Argon2 hash
WithServiceAccountRLS bypass for setup
postgres.go / bootstrap.goDSN, migrate, test DB

Coverage gate scope

  • Included: packages/* (except packages/proto/gen/go), services/auth, services/proxy
  • Excluded: packages/proto/gen/go/** (generated stubs), infra/** (test fixtures, migrate CLI — covered by dedicated jobs)
  • Contract tests: packages/proto/*_contract_test.go — compile-time + descriptor checks
  • Gate script: infra/scripts/coverage-gate.sh filters merged profile before enforcing ≥80%

Tier policy (Phase 0 audit)

TierActionExamples
AKEEPSEC suite, integration tests, contract tests, grpc unit tests
BDELETEnil-getter, accessor padding, grpc_extra iteration in gen/
CAUGMENTcmd wiring, validation edges, healthcheck, ratelimit
DREWRITE sectionstime.Sleep in shutdown tests → sync/poll
Edit on GitHub

Last updated on

On this page

0%