Rework PostgresNode's psql method
Alvaro Herrera <alvherre@alvh.no-ip.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/pg_basebackup/t/010_pg_basebackup.pl | modified | +11 −11 |
| src/bin/pgbench/t/001_pgbench.pl | modified | +1 −1 |
| src/bin/scripts/t/010_clusterdb.pl | modified | +1 −1 |
| src/bin/scripts/t/030_createlang.pl | modified | +1 −1 |
| src/bin/scripts/t/050_dropdb.pl | modified | +1 −1 |
| src/bin/scripts/t/070_dropuser.pl | modified | +1 −1 |
| src/bin/scripts/t/090_reindexdb.pl | modified | +1 −1 |
| src/test/modules/commit_ts/t/001_base.pl | modified | +4 −4 |
| src/test/modules/commit_ts/t/002_standby.pl | modified | +12 −10 |
| src/test/modules/commit_ts/t/003_standby_2.pl | modified | +11 −9 |
| src/test/perl/PostgresNode.pm | modified | +249 −19 |
| src/test/recovery/t/001_stream_rep.pl | modified | +5 −15 |
| src/test/recovery/t/002_archiving.pl | modified | +5 −5 |
| src/test/recovery/t/003_recovery_targets.pl | modified | +13 −13 |
| src/test/recovery/t/004_timeline_switch.pl | modified | +5 −5 |
| src/test/recovery/t/005_replay_delay.pl | modified | +5 −5 |