Skip to content

test: add end-to-end test spanning order, kitchen, and notification - #8

Merged
devinder-dev merged 1 commit into
mainfrom
phase-6-e2e
Jun 21, 2026
Merged

devinder-dev merged 1 commit into
mainfrom
phase-6-e2e

Conversation

@devinder-dev

Copy link
Copy Markdown
Owner

Summary

  • New tests/e2e workspace package wires order, kitchen, and notification together in one test - the last item on CLAUDE.md's testing pyramid
  • One Postgres container hosting all 3 service databases (same shape as docker/init.sql), one shared RabbitMQ + Redis container, each service's real entrypoint dynamically imported in sequence
  • A real POST /orders drives the full happy path; the test polls both kitchen's and notification's own databases until the chain completes
  • This closes out the entire build plan - all phases 0 through 6 are now done

Also fixes

  • Running bun test from the repo root executes every test file across all packages in one OS process by default. Since each service's db.ts reads DATABASE_URL from process.env once at module-load time, a later test file could receive an already-cached module pointing at an earlier file's already-stopped Testcontainers Postgres.
  • Tried bun test --isolate (fresh module/global context per file) - didn't fully fix it, since process.env is still process-wide, and it silently stopped honoring bunfig.toml's test timeout.
  • Real fix: every package with tests now has its own "test" script, and the root script runs them via bun's workspace filter (bun run --filter '*' --sequential test), which spawns each package's tests as a genuinely separate OS process. CI's test step updated to match.

Test plan

  • bun run typecheck green across all services, including the new tests/e2e project
  • Snyk code scan on tests/e2e - 0 issues
  • bun run test from the repo root: every package's suite passes (order 4, kitchen 2, notification 2, menu 2, shared 2, e2e 1 - 13 total)
  • Confirmed stable across multiple repeated full runs, exit code 0 every time
  • No orphaned Testcontainers left running after the suite (Ryuk reaper confirmed clean)

New tests/e2e workspace package wires all three services together in
one test: one Postgres container hosting all 3 service databases (same
shape as docker/init.sql), one shared RabbitMQ + Redis container, each
service's real entrypoint imported in sequence. A real POST /orders
drives the full happy path; the test polls both kitchen's and
notification's own databases until it completes. This is the last item
on the testing pyramid - every phase of the build plan is now done.

Also fixes how the whole suite runs together: bun test from the repo
root executes every test file in one process by default, and since
each service's db.ts reads DATABASE_URL from process.env once at
module-load time, a later test file could pick up an already-cached
module pointing at an earlier file's stopped container. Each package
with tests now has its own "test" script, and the root script runs
them via bun's workspace filter (one OS process per package), which is
real isolation rather than just module-context isolation.
@devinder-dev
devinder-dev merged commit 9874f53 into main Jun 21, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant