Skip to content

fix(tests): update connection test suite for psql 18 conninfo format change and trust-auth port #715

@NikolayS

Description

@NikolayS

Problem

tests/compat/test-connections.sh reports 6 failures on this machine but none are real rpg bugs:

A1–A5: \conninfo format mismatch

psql 18 changed \conninfo output from a one-liner:

You are connected to database "postgres" as user "postgres" on host "localhost" (address "::1") at port "5432".

to a tabular format:

      Connection Information
      Parameter       |   Value
----------------------+-----------
 Database             | postgres
 ...

rpg outputs the classic one-liner (correct behavior, matches psql < 18). The test does a literal string compare against whatever psql outputs, so it fails on any machine with psql 18+.

Fix: Don't use \conninfo for connection-path tests. Use SELECT current_database(), current_user, inet_server_addr()::text, inet_server_port() instead — stable output across all psql versions, and still proves the connection path works.

A7: Wrong password test uses trust-auth port

Test expects non-zero exit when connecting with wrong password, but the test port uses trust auth — Postgres ignores the password and lets anyone in. Test always gets exit 0.

Fix: Run A7 against a SCRAM-auth port (TEST_PG_SCRAM_PORT, default 5432 or a dedicated port). CI already has a SCRAM service available.

Impact

These failures make the test suite output look alarming and mask real failures. The connection paths themselves (A1–A5) are working correctly.

Fix

  • Replace \conninfo with a stable SQL query in A1–A5
  • Add TEST_PG_SCRAM_HOST/TEST_PG_SCRAM_PORT/TEST_PG_SCRAM_PASSWORD env vars for A7
  • Update .github/workflows/checks.yml to pass the SCRAM service connection details to the test step (service already exists as the default postgres service with POSTGRES_PASSWORD)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions