test(connection): add connection path integration tests (#709)#730
test(connection): add connection path integration tests (#709)#730
Conversation
Adds tests/connection_paths.rs covering the full connection path matrix from issue #709. Tests use std::process::Command to invoke the rpg binary against local Postgres instances. Covers: A — TCP (basic, PGPASSWORD, explicit -d) B — Unix socket (explicit host, PGHOST env; skipped when absent) C — URI/connstring (postgres://, postgresql://, ?sslmode=, host param, key=value) D — SSL modes (prefer self-signed, require self-signed, require no-TLS, prefer fallback) E — Env vars (PGHOST/PGPORT, PGPASSWORD, PGUSER, PGAPPNAME, PGSSLMODE) F — Error message quality (wrong password, connection refused, unknown host) G — Auth methods (trust, SCRAM-SHA-256) H — Multiple -c flags, -f file execution CI: gated in the existing connection-tests job (same TLS docker step from #714). Env var mapping: CONN_* overrides with TEST_PG_* fallbacks for CI compatibility. Ref #709
|
REV: connection path integration tests (#709) OverviewGood addition. The test file is readable, the env var indirection pattern is sound, and the coverage of groups A through H follows the #709 matrix closely. There are no blocking correctness bugs, but there are a few issues worth addressing before merging. Issue 1 — CI step missing
|
- Add --release flag to connection-tests CI step to reuse already-built release binary instead of triggering a full debug build - Replace duplicate e2_pgpassword (identical to a2_tcp_pgpassword) with e2_pgport_env which tests that PGPORT env var overrides default port - Tighten f3_unknown_host_clear_error to check stderr for specific DNS error strings instead of broad combined-output keyword matching - Apply cargo fmt formatting throughout
All 26 tests in tests/connection_paths.rs now carry: #[ignore = "requires live Postgres — run via connection-tests CI job"] This prevents them from running in the generic 'Checks / Test' job (no Postgres on ports 15433/15434/15436), causing ~20 connection-refused failures. The connection-tests CI job passes -- --include-ignored so the tests still run there against the live services. Also fix 18 clippy::doc_markdown warnings in the file doc comment and function doc comments (env var names, SQL function names, and column names wrapped in backticks).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #730 +/- ##
=======================================
Coverage 68.80% 68.80%
=======================================
Files 46 46
Lines 31000 31000
=======================================
Hits 21327 21327
Misses 9673 9673 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds
tests/connection_paths.rscovering the full connection path matrix from issue #709. Tests usestd::process::Commandto invoke the rpg binary against local Postgres instances.Covers: TCP (A), Unix socket (B), URI/connstring (C), SSL modes (D), env vars (E), error message quality (F), auth methods (G), multiple -c/-f flags (H).
Test groups
CI integration
Tests are added to the existing
connection-testsjob inchecks.yml, running after the TLS docker step from #714. Env var mapping usesCONN_*overrides withTEST_PG_*fallbacks for full CI compatibility.Local results
Ref #709