From 9b6c7ce67919974b4725aab77694f4d1ad38b9d5 Mon Sep 17 00:00:00 2001 From: Leigh Anne Miller Date: Thu, 24 Sep 2026 13:05:06 -0600 Subject: [PATCH] Build: CI's dev-database step names port 5433 The step ran `psql -h localhost` with no -p, which means 5432 without the number ever appearing, so the port test's scan could not see it. A new test fails if any psql/createdb/dropdb/pg_dump/pg_restore line in CI connects to localhost without -p 5433. Red before, green after. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/ci.yml | 2 +- tests/test_database_port.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 399e495..43bec51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - name: Create dev database env: PGPASSWORD: dess_dev_only - run: psql -h localhost -U dess -d dess_test -c "CREATE DATABASE dess OWNER dess;" + run: psql -h localhost -p 5433 -U dess -d dess_test -c "CREATE DATABASE dess OWNER dess;" - name: Apply Alembic migrations to test DB env: diff --git a/tests/test_database_port.py b/tests/test_database_port.py index 2b50d6d..91fa12b 100644 --- a/tests/test_database_port.py +++ b/tests/test_database_port.py @@ -76,3 +76,20 @@ def test_no_tracked_file_points_dess_at_5432() -> None: if DEFAULT_PORT.search(line): offenders.append(f"{path.relative_to(REPO)}:{i} {line.strip()}") assert not offenders, "DESS must not use port 5432:\n" + "\n".join(offenders) + + +def test_ci_database_commands_name_5433() -> None: + """`psql -h localhost` with no `-p` means 5432 — implicitly. The number + never appears, so the scan above cannot see it; this does. It is the + gap that turned CI red on the day the port moved.""" + ci = (REPO / ".github" / "workflows" / "ci.yml").read_text() + offenders = [ + line.strip() + for line in ci.splitlines() + if re.search(r"\b(psql|createdb|dropdb|pg_dump|pg_restore)\b", line) + and "-h localhost" in line + and f"-p {PORT}" not in line + ] + assert not offenders, "CI database commands must say -p 5433:\n" + "\n".join( + offenders + )