pgsql: Fix portability issues in new TAP tests of psql

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix portability issues in new TAP tests of psql
Date: 2021-10-18 00:58:24
Message-ID: E1mcGyu-0005Ed-Ok@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix portability issues in new TAP tests of psql

The tests added by c0280bc and d9ddc50 in 001_basic.pl have introduced
commands calling directly psql, making them sensitive to the
environment. One issue was that those commands forgot -X to not use a
local .psqlrc, causing all those tests to fail if psql cannot properly
parse this file.

TAP tests should be designed so as they run in an isolated fashion,
without any dependency on the environment where they are run. As
PostgresNode::psql gives already all the facilities those new tests
need, switch to that instead of calling plain psql commands where
interactions with a backend are needed. The test is slightly refactored
to be able to check after the expected patterns of stdout and stderr,
keeping the same amount of coverage as previously.

Reported-by: Peter Geoghegan
Discussion: https://postgr.es/m/CAH2-Wzn8ftvcDPwomn+y04JJzbT=TG7TN=QsmSEATUOW-ZuvQQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/384f1abdb9b0f669279fcd57ba2173eb31724740

Modified Files
--------------
src/bin/psql/t/001_basic.pl | 52 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-10-18 01:04:58 Re: pgsql: Add more $Test::Builder::Level in the TAP tests
Previous Message Andrew Dunstan 2021-10-17 16:01:27 Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.