pgsql: Fix portability issues in new TAP tests of psql - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Fix portability issues in new TAP tests of psql
Date
Msg-id E1mcGyu-0005Ed-Ok@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
Next
From: Michael Paquier
Date:
Subject: Re: pgsql: Add more $Test::Builder::Level in the TAP tests