fix(tests): stable conninfo query and SCRAM port for wrong-password test#716
fix(tests): stable conninfo query and SCRAM port for wrong-password test#716
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #716 +/- ##
=======================================
Coverage 68.79% 68.79%
=======================================
Files 46 46
Lines 30992 30992
=======================================
Hits 21318 21318
Misses 9674 9674 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
REV Review — PR #716: fix(tests): stable conninfo query and SCRAM port for wrong-password testSummaryFixes two pre-existing test failures: replaces the version-sensitive Blocking findingsNone. Non-blocking findings
Potential issues
Test coverageGood. The two changes together make the test suite genuinely meaningful:
CI integration is correct: health checks ensure the container is ready before tests run, the job fails the pipeline on any test failure, and no VerdictAPPROVE |
15363ac to
6f189c5
Compare
A1-A5: replace \conninfo with a SQL query that returns identical output from both psql and rpg on all versions: SELECT current_database() AS db, current_user AS usr, inet_server_port() AS port psql 18 changed the \conninfo output format, breaking literal string comparison in the test suite. rpg is correct; the test was wrong. A7: test_wrong_password previously ran against the trust-auth port (15433), where Postgres ignores the password — always returning exit 0. The test expected non-zero exit, so it always failed. Fix: add TEST_PG_SCRAM_HOST/PORT/USER/PASSWORD/DATABASE env vars. When TEST_PG_SCRAM_PORT is set, A7 connects to that SCRAM-auth instance with a wrong password and expects non-zero exit. When not set, A7 is skipped with a clear message. In checks.yml, add a postgres-scram service to the connection-tests job (port 15433, default POSTGRES_PASSWORD=postgres which triggers scram-sha-256) and pass the SCRAM env vars to the test step. Closes #715
6f189c5 to
76adfe1
Compare
Problem
Fixes two failures in
tests/compat/test-connections.sh.A1-A5: psql 18
\conninfoformat changepsql 18 changed the output format of
\conninfo. The tests do a literal string compare between psql and rpg output, so they fail on any machine with psql 18+. rpg is correct — the test was wrong.Fix: Replace
\conninfowith a stable SQL query across all A1-A5 tests:This returns identical output from both psql and rpg on all versions, and proves the connection succeeded.
A7: wrong-password test against trust-auth port
test_wrong_passwordconnected to the trust-auth port (15433), where Postgres ignores the supplied password. The test expected non-zero exit but got 0 — always failing.Fix: Add
TEST_PG_SCRAM_HOST/TEST_PG_SCRAM_PORT/TEST_PG_SCRAM_USER/TEST_PG_SCRAM_PASSWORD/TEST_PG_SCRAM_DATABASEenv vars. WhenTEST_PG_SCRAM_PORTis set, A7 runs against that SCRAM-auth instance with a wrong password and asserts non-zero exit. When not set, A7 is skipped with a clear message.In
.github/workflows/checks.yml, a second postgres service (postgres-scram) is added to theconnection-testsjob on port 15433. The defaultPOSTGRES_PASSWORDtriggers scram-sha-256 auth. The SCRAM env vars are passed to the test step.Testing
Verified locally against trust-auth (port 15433) and SCRAM-auth (port 15434):
Closes #715