Task: Run the database-backed integration tests in CI #28

Open
opened 2026-10-03 17:38:04 +00:00 by araemer · 0 comments
Owner

Spec 002 adds database-backed integration tests (npm run test:integration, files named *.integration.test.ts). They need a real PostgreSQL. The PR check runs on a runner without a database available to the pipeline, so these tests only run when someone runs them by hand.

Why it matters

They are the only tests that catch a wrong lock order in the shopping list item writes (the "change row is written last" rule) and errors in the hand-written overview queries. Unit tests mock the repositories and cannot see either. A test that only runs by hand gets skipped, and a later change to the item writes can then break the rule unnoticed.

Options

  • PostgreSQL as a service container in pr_check.yaml. Needs Docker on the runner (the Raspberry Pi).
  • A dedicated test database on the existing PostgreSQL, with its connection settings as pipeline secrets. The test setup already creates and drops its own schema per run, so parallel or repeated runs do not interfere.

Done when

  • pr_check.yaml runs npm run test:integration and fails the check when it fails.
  • CLAUDE.md and docs/architecture.md no longer say the integration tests are outside CI.

Context

Left open in the spec 002 backend plan (docs/plans/002-shopping-list-overview-previews.md, judgment call 1). It is a decision about the runner setup, not about the feature.

Spec 002 adds database-backed integration tests (`npm run test:integration`, files named `*.integration.test.ts`). They need a real PostgreSQL. The PR check runs on a runner without a database available to the pipeline, so these tests only run when someone runs them by hand. ## Why it matters They are the only tests that catch a wrong lock order in the shopping list item writes (the "change row is written last" rule) and errors in the hand-written overview queries. Unit tests mock the repositories and cannot see either. A test that only runs by hand gets skipped, and a later change to the item writes can then break the rule unnoticed. ## Options - **PostgreSQL as a service container in `pr_check.yaml`.** Needs Docker on the runner (the Raspberry Pi). - **A dedicated test database on the existing PostgreSQL**, with its connection settings as pipeline secrets. The test setup already creates and drops its own schema per run, so parallel or repeated runs do not interfere. ## Done when - `pr_check.yaml` runs `npm run test:integration` and fails the check when it fails. - `CLAUDE.md` and `docs/architecture.md` no longer say the integration tests are outside CI. ## Context Left open in the spec 002 backend plan (`docs/plans/002-shopping-list-overview-previews.md`, judgment call 1). It is a decision about the runner setup, not about the feature.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
araemer/recipe-backend#28
No description provided.