pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Rework PostgresNode's psql method
Date: Thu, 03 Mar 2016 20:58:55 +0000
Message-ID: <E1abaKl-0006Yd-3w@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Rework PostgresNode's psql method

This makes the psql() method much more capable: it captures both stdout
and stderr; it now returns the psql exit code rather than stdout; a
timeout can now be specified, as can ON_ERROR_STOP behavior; it gained a
new "on_error_die" (defaulting to off) parameter to raise an exception
if there's any problem.  Finally, additional parameters to psql can be
passed if there's need for further tweaking.

For convenience, a new safe_psql() method retains much of the old
behavior of psql(), except that it uses on_error_die on, so that
problems like syntax errors in SQL commands can be detected more easily.

Many existing TAP test files now use safe_psql, which is what is really
wanted.  A couple of ->psql() calls are now added in the commit_ts
tests, which verify that the right thing is happening on certain errors.
Some ->command_fails() calls in recovery tests that were verifying that
psql failed also became ->psql() calls now.

Author: Craig Ringer. Some tweaks by Álvaro Herrera
Reviewed-By: Michaël Paquier

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2c83f435a3deca745c666e9778229d64cb2dfc79

Modified Files
--------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl  |  22 +--
src/bin/pgbench/t/001_pgbench.pl              |   2 +-
src/bin/scripts/t/010_clusterdb.pl            |   2 +-
src/bin/scripts/t/030_createlang.pl           |   2 +-
src/bin/scripts/t/050_dropdb.pl               |   2 +-
src/bin/scripts/t/070_dropuser.pl             |   2 +-
src/bin/scripts/t/090_reindexdb.pl            |   2 +-
src/test/modules/commit_ts/t/001_base.pl      |   8 +-
src/test/modules/commit_ts/t/002_standby.pl   |  22 ++-
src/test/modules/commit_ts/t/003_standby_2.pl |  20 +-
src/test/perl/PostgresNode.pm                 | 268 ++++++++++++++++++++++++--
src/test/recovery/t/001_stream_rep.pl         |  20 +-
src/test/recovery/t/002_archiving.pl          |  10 +-
src/test/recovery/t/003_recovery_targets.pl   |  26 +--
src/test/recovery/t/004_timeline_switch.pl    |  10 +-
src/test/recovery/t/005_replay_delay.pl       |  10 +-
16 files changed, 326 insertions(+), 102 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1abaKl-0006Yd-3w@gemulon.postgresql.org>
Permalink:  ../E1abaKl-0006Yd-3w@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1abaKl-0006Yd-3w@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Rework PostgresNode's psql method
  In-Reply-To: <E1abaKl-0006Yd-3w@gemulon.postgresql.org>
  References: <E1abaKl-0006Yd-3w@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox