Skip to content

docs: integration-test bring-up flow + commit compose override#56

Merged
CryptoJones merged 1 commit into
masterfrom
docs/integration-test-bringup-flow
May 18, 2026
Merged

docs: integration-test bring-up flow + commit compose override#56
CryptoJones merged 1 commit into
masterfrom
docs/integration-test-bringup-flow

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Follow-up to #55, which shipped the harness but not the operational doc for actually running it. After driving the full bring-up against a live PG this session, three missing pieces became clear:

  1. docker-compose.override.yml committed: exposes 127.0.0.1:5432 for host-side test runs. The base compose deliberately keeps PG internal; the override is opt-in for the test path.
  2. down -v step documented: setup/TimeTracker.sql's unconditional CREATE SCHEMA dbo blows up against a populated volume (exit 3). Workaround documented; a follow-up issue tracks the idempotency fix.
  3. Exact env-var shape for the integration suite spelled out.

README gets a short Testing section. tests/integration/README.md rewritten end-to-end.

Test plan

  • Override file rebuilds the compose graph correctly (verified via docker compose config)
  • Following the documented bring-up against a fresh volume: postgres healthy, setup Exited(0), migrate Exited(0), vitest integration suite 4/4 green this session
  • npm test (without DB env vars) still passes; the integration suite skips cleanly

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

After the harness in #55 landed, the actual flow to run integration
tests against a live Postgres turned out to need three things the
docs didn't mention:

  1. docker-compose.override.yml that exposes 127.0.0.1:5432 to
     the host. The base docker-compose.yml deliberately keeps PG
     unreachable from the host for production hardening, but the
     vitest integration suite needs host-side TCP access.

  2. \`docker compose down -v\` before re-running setup. The
     setup/TimeTracker.sql script does an unconditional
     \`CREATE SCHEMA dbo\` which fails (exit 3) against a
     populated postgres-data volume. Filed as a separate
     idempotency-fix tracker.

  3. The exact env-var shape the integration suite reads
     (DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD).

The override file is committed so contributors don't have to
re-derive it. Production deployments should NOT use this
override — port 5432 on a public host is a credential-brute-force
invitation. The override's purpose and risk note are inline in
the file's comment header.

README gets a short "Testing" section pointing at
tests/integration/README.md for the full flow. The integration
README itself is rewritten end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 422b8b1 into master May 18, 2026
1 check was pending
@CryptoJones CryptoJones deleted the docs/integration-test-bringup-flow branch May 18, 2026 00:22
CryptoJones added a commit that referenced this pull request May 18, 2026
#57)

setup/TimeTracker.sql is the pg_dump-produced bootstrap script. It
wasn't authored with idempotency in mind: \`CREATE SCHEMA dbo\`
(no IF NOT EXISTS), followed by ~40 statements that include
\`CREATE TABLE\` without IF NOT EXISTS and \`ALTER TABLE ADD
CONSTRAINT\` (which has no IF NOT EXISTS form at all).

Result: \`docker compose up setup\` against a populated postgres
volume exits 3 with "schema dbo already exists", which in turn
prevents the chained \`migrate\` service from running, which left
the docs in PR #56 with the \`docker compose down -v\` papercut.

Rather than retrofit IF-NOT-EXISTS guards to every individual
statement (and lose on ADD CONSTRAINT), gate the entire file at
the top with a psql \\if check:

  SELECT EXISTS (
      SELECT 1 FROM information_schema.schemata WHERE schema_name = 'dbo'
  ) AS dbo_exists \\gset
  \\if :dbo_exists
  \\echo 'dbo schema already exists — setup/TimeTracker.sql is a no-op'
  \\q
  \\endif

If the schema is there, psql exits 0 with a friendly message;
the chained migrate service then runs as designed. If the schema
isn't there, the rest of the pg_dump body executes exactly as
before.

Verified locally against the running compose postgres:
  - DROP SCHEMA dbo CASCADE → fresh run exit 0, 14 tables created
  - immediate re-run → "no-op" message, exit 0
  - subsequent migrate service still works (verified earlier this session)

Co-authored-by: Aaron K. Clark <akclark@thenetwerk.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CryptoJones added a commit that referenced this pull request May 18, 2026
Continues the docs-sync pattern from #44 and #53. CHANGELOG
[Unreleased] now reflects:

  Added:
    - Sequelize associations (#54)
    - Integration test harness (#55)
    - Postman collection (#59)
    - TLS reverse-proxy compose (#60)
    - docker-compose.override.yml committed (#56)

  Fixed:
    - setup/TimeTracker.sql idempotency (#57) — removes the
      \`docker compose down -v\` workaround

  Docs:
    - Integration bring-up flow (#56, #58)
    - README sections for Testing and Behind TLS

Co-authored-by: Aaron K. Clark <akclark@thenetwerk.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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