test: add PostgreSQL migration integration coverage
CI / verify (pull_request) Successful in 19s
CI / infrastructure-smoke (pull_request) Successful in 21s
CI / migration-smoke (pull_request) Failing after 16s

This commit is contained in:
ekklesia
2026-07-21 09:37:15 -05:00
parent b38f85f438
commit 831a48187c
16 changed files with 1690 additions and 96 deletions
+18 -6
View File
@@ -24,6 +24,7 @@ pnpm migrations:plan # read-only comparison with PostgreSQL applied history
pnpm migrations:apply # locked, transactional application of the pending batch
pnpm typecheck # strict TypeScript
pnpm test # Vitest
pnpm test:migrations:integration # production runner against disposable PostgreSQL
pnpm build # Turborepo package build graph
pnpm verify # every code-only gate; never plan or apply
```
@@ -63,13 +64,24 @@ The default command composition supplies no destructive approvals. There is no `
or source-controlled approval escape hatch; deployments must later compose a trusted external
provider that supplies an exact module ID, migration identity, and checksum triple.
The migration runner currently has comprehensive unit coverage through its narrow database port.
Live PostgreSQL tests for real DDL rollback, advisory-lock contention, history-table behavior, and
driver cleanup are deliberately deferred and are not part of `pnpm verify` or CI yet.
Migration-runner unit tests cover orchestration through its narrow database port. Run the separate
live suite when changing migration behavior:
CI runs `pnpm ci:verify`, which adds Compose configuration validation to `pnpm verify`. A separate
CI job runs the live infrastructure smoke test so code-only local verification does not require
Docker. The explicit suffix avoids pnpm's built-in `ci` install command.
```bash
pnpm test:migrations:integration
```
It requires Docker with Compose, starts the pinned PostgreSQL image with a generated throwaway
credential and a Docker-assigned loopback port, creates an isolated database for each scenario,
and removes its containers, network, databases, and volume afterward. It exercises the production
adapter and real PostgreSQL transactions, history, advisory locks, approvals, and sanitized errors.
It remains outside the Docker-free `pnpm verify` command.
CI runs `pnpm ci:verify`, which adds Compose configuration validation to `pnpm verify`. Separate
`infrastructure-smoke` and `migration-smoke` jobs run the live service and migration suites. The
exact pull-request context to add to `main` branch protection after merge is
`CI / migration-smoke (pull_request)`. The explicit `ci:verify` suffix avoids pnpm's built-in `ci`
install command.
## Development infrastructure