Skip to main content

Platform Admin Service — Testing Strategy

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: TESTING_STANDARDS · DEFINITION_OF_DONE

1. Coverage targets

TierTargetGate
Unit≥ 80% statements + linesVitest CI
IntegrationMandatory scenarios belowCI gate
Contract (Pact)All produced events + internal evaluatePact broker
E2EConfig → service read; flag evaluate flowPlaywright staging

2. Mandatory integration tests

2.1 Tenant isolation (test/integration/tenant-isolation.spec.ts)

ScenarioAssertion
TENANT scope config for Tenant A not visible to Tenant BGuard + DB filter
Tenant Admin cannot read PLATFORM scope config403

2.2 Outbox (test/integration/outbox.spec.ts)

ScenarioAssertion
Config upsert writes config + outbox row atomicallyDB transaction
Outbox relay publishes platform_admin.config.updated.v1Event received

2.3 Inbox (test/integration/inbox.spec.ts)

ScenarioAssertion
tenant.tenant.activated.v1 triggers default config provisioningConfig rows created
Duplicate event processed idempotentlyNo duplicate config rows

2.4 Feature flag evaluation

ScenarioAssertion
defaultEnabled=true, no overrides → enabled=trueCorrect decision
defaultEnabled=true, tenant in disabledTenantIdsenabled=falseOverride takes precedence
Archived flag → always enabled=false regardless of overridesInvariant enforced
Cache hit within 60 s → same result, cache hit counter incrementedCache behavior
Cache miss after 60 s → DB query executedTTL expiry

2.5 Health aggregation

ScenarioAssertion
All sources healthy → overall=healthyAggregation correct
One source unhealthy → overall=unhealthyAggregation correct
Source heartbeat expired → treated as unhealthyStaleness policy

3. Contract tests (Pact)

SubjectFile
platform_admin.config.updated.v1test/contract/config.updated.schema.spec.ts
platform_admin.flag.updated.v1test/contract/flag.updated.schema.spec.ts
Internal evaluate (consumer: identity-service)test/contract/identity-flag-evaluate.pact.spec.ts

4. E2E tests (staging)

ScenarioFile
Super admin upserts config → identity-service reads new valueconfig-propagation.e2e.spec.ts
Flag created + tenant override → evaluate returns overrideflag-evaluate-override.e2e.spec.ts
Health aggregate reflects real service healthhealth-aggregate.e2e.spec.ts

5. Performance test

Internal evaluate endpoint must achieve p95 ≤ 120 ms under 1000 RPS simulated load in staging. Tested as part of M1 readiness gate.