Skip to content

test(infra): local postgres test-db for trypost-fork on port 5433 - #6

Merged
Cryptoom merged 1 commit into
mainfrom
claude/tpx-01-test-infra
Sep 16, 2026
Merged

Cryptoom merged 1 commit into
mainfrom
claude/tpx-01-test-infra

Conversation

@Cryptoom

Copy link
Copy Markdown
Owner

Summary

Plan ~/.claude/plans/proud-bubbling-dewdrop.md, Paket T0.

This machine has no working local test database for trypost-fork. Port 5432
is occupied by another project's Docker container (blogmaker-test-db),
so .env.testing (DB_HOST=127.0.0.1, formerly DB_PORT=5432) was pointing at
the wrong Postgres server, and the entire Facebook publisher test suite
failed 25/0.

  • Adds compose.test.yml: a minimal, isolated Postgres 16 container bound
    to 127.0.0.1:5433 only, separate from the full compose.yaml dev stack
    (which already forwards 5432 by default and is meant to run alongside the
    Dockerized app service). Reuses docker/postgres-init.sh to create the
    trypost_test database, matching the existing convention.
  • Updates .env.testing: DB_PORT=5433, DB_USERNAME=postgres,
    DB_PASSWORD=password (matches the value already committed in
    phpunit.xml, no new secret).
  • Adds a ## Local Test Database section to CLAUDE.md documenting the
    container start/stop/reset commands, the passport:keys requirement
    (storage/oauth-*.key are gitignored and not generated by default,
    causing every OAuth-backed test to fail with Invalid key supplied until
    generated), the memory-limit bump needed for the image-processing tests,
    and why php artisan test cannot be used locally without a .env file
    (it boots the console kernel against the default env before PHPUnit's
    <php><env> block applies, unlike vendor/bin/pest invoked directly).

Test plan

  • Full suite green: APP_ENV=testing php -d memory_limit=1024M vendor/bin/pest --compact -> 4553 passed, 2 skipped, 0 failed (16396 assertions), run twice for consistency.
  • The two new Facebook story publisher tests from a30d83c (facebook publisher can publish video story, facebook publisher fails story publish when start does not return upload_url) are included and pass (39/39 in that file).
  • Koeder test (proves the suite actually verifies, not just runs green): inverted an assertion in facebook publisher can publish video story, confirmed it failed red (Failed asserting that two strings are identical), reverted, confirmed green again (39 passed).
  • Code review: subagent code-reviewer PASS (security, secrets, bind address, doc placement, dash-convention, consistency with compose.yaml all checked; one cosmetic note on a differing healthcheck interval, no blocker) plus independent self-review, both agree.
  • check-dashes.sh --staged: clean.
  • git check-ignore -v .env.testing: confirmed tracked (only /docs/ is gitignored, not this file).

Follow-up chips A0-A5 and B0-B4 all depend on this green test database and
can start once this is merged.

Port 5432 is occupied by another project's Docker container on this
machine, so .env.testing's DB_HOST=127.0.0.1 pointed at the wrong
database and the entire test suite failed with a bad auth error.

Adds compose.test.yml, a minimal, isolated Postgres 16 container
(binds 127.0.0.1:5433 only) dedicated to the test suite, independent
from the full compose.yaml dev stack. Reuses docker/postgres-init.sh
to create the trypost_test database, matching the existing convention.

Updates .env.testing to point at the new port and credentials
(DB_PASSWORD already matched phpunit.xml's committed value, DB_USERNAME
now matches the container's postgres user).

Documents the setup, the passport:keys requirement (storage/oauth-*.key
are gitignored and not generated by default, causing every OAuth-backed
test to fail with "Invalid key supplied" until generated), the memory
limit needed for image-processing tests, and why php artisan test
cannot be used locally (it boots the full console kernel against the
default .env before phpunit's env vars apply) in a new CLAUDE.md
section.

Full suite verified green: 4553 passed, 2 skipped, 0 failed.
Koeder test: inverted an assertion in the newly landed Facebook story
publisher test (a30d83c), confirmed it failed red, reverted, confirmed
green again.
@Cryptoom
Cryptoom merged commit 72dc5d5 into main Sep 16, 2026
@Cryptoom
Cryptoom deleted the claude/tpx-01-test-infra branch September 16, 2026 21:05
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