Skip to content

Add test preflight and parameterize PostgreSQL connection in Makefile#55

Merged
seanwevans merged 2 commits into
mainfrom
codex/parameterize-db-connection-in-makefile
May 20, 2026
Merged

Add test preflight and parameterize PostgreSQL connection in Makefile#55
seanwevans merged 2 commits into
mainfrom
codex/parameterize-db-connection-in-makefile

Conversation

@seanwevans
Copy link
Copy Markdown
Owner

Motivation

  • Make tests robust and environment-agnostic by allowing PGDATABASE, PGHOST, PGPORT, and PGUSER to be configured instead of hardcoding -d postgres.
  • Ensure local and Docker test runs perform the same prerequisite checks so test failures are actionable and consistent.

Description

  • Parameterized the test DB connection in makefile by adding PGDATABASE, PGHOST, PGPORT, and PGUSER defaults and a shared PSQL helper that respects those variables.
  • Added a test-preflight target that checks for pg_prove on PATH, verifies PostgreSQL connectivity using the configured connection variables, and checks that required extensions (pgcrypto, pg_trgm, plpython3u) are installed, emitting actionable error messages on failure.
  • Made the test target depend on test-preflight and invoke pg_prove with explicit -h, -p, -U, and -d flags so test execution uses the same connection settings.
  • Updated README.md and CONTRIBUTING.md with a minimal known-good local vs Docker testing matrix and notes that make test includes the preflight; Docker Compose already runs make test so containerized runs now execute the same preflight checks.

Testing

  • Attempted to run make -n test to validate Makefile behavior, but the dry-run/build was blocked by a missing PGXS include path in the execution environment (/usr/lib/postgresql/16/lib/pgxs/src/makefiles/pgxs.mk).
  • Attempted to run make test-preflight in the containerized environment but the full make execution could not complete due to the same PGXS/environment limitation, so preflight could not be fully exercised here.

Codex Task

@seanwevans seanwevans merged commit 71ef07c into main May 20, 2026
1 check failed
@seanwevans seanwevans deleted the codex/parameterize-db-connection-in-makefile branch May 20, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant