Unverified Commit 2a55a0d2 authored by Lemon-miaow's avatar Lemon-miaow
Browse files

test(pgint): verify the business stores against a real Postgres

The hermetic suites encode the store contracts against fakes; PGRepo drifted
behind them three times (attempt accounting, a missing JOIN, a missing FOR
UPDATE) while every unit test stayed green. This harness replays the real
embedded migrations onto a throwaway database — its name must contain "pgint"
or the harness refuses to run — and exercises the SQL directly: sessions, the
onboarding email-OTP lifecycle (supersede/expiry/lockout), the pre-session
login consume, the op-login state machine, link and bind-code redemption,
submissions, and builds with the image admission round trip.

Run it after touching SQL under internal/api/pgrepo.go, internal/submit, or
internal/build; CONTRIBUTING.md carries the one-liner.
parent d2c65653
Loading
Loading
Loading
Loading
+14 −0
Changes for CONTRIBUTING.md: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -67,6 +67,20 @@ go test ./internal/api
go test ./cmd/felis
```

The hermetic suites run against in-memory fakes; the business stores' SQL is
verified separately against a real Postgres, on a throwaway database whose name
must contain `pgint` (the harness drops and recreates its schema and replays the
embedded migrations):

```bash
FELIS_TEST_PG_URL='postgres://felis:***@127.0.0.1:5432/felis_pgint?sslmode=disable' \
  go test -tags pgint ./internal/pgint/ -v
```

Run it after touching anything under `internal/api/pgrepo.go`, `internal/submit`,
or `internal/build` that speaks SQL: the fakes encode the contract, and this
suite exists to catch the drift between the fakes and the real queries.

Build the CLI:

```bash
+716 −0

File added.

Preview size limit exceeded, changes collapsed.