From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Refactor Perl test code |
Date: | 2015-12-02 21:55:03 |
Message-ID: | E1a4FMd-0004iR-Ow@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Refactor Perl test code
The original code was a bit clunky; make it more amenable for further
reuse by creating a new Perl package PostgresNode, which is an
object-oriented representation of a single server, with some support
routines such as init, start, stop, psql. This serves as a better basis
on which to build further test code, and enables writing tests that use
more than one server without too much complication.
This commit modifies a lot of the existing test files, mostly to remove
explicit calls to system commands (pg_ctl) replacing them with method
calls of a PostgresNode object. The result is quite a bit more
straightforward.
Also move some initialization code to BEGIN and INIT blocks instead of
having it straight in as top-level code.
This commit also introduces package RecursiveCopy so that we can copy
whole directories without having to depend on packages that may not be
present on vanilla Perl 5.8 installations.
I also ran perltidy on the modified files, which changes some code sites
that are not otherwise touched by this patch. I tried to avoid this,
but it ended up being more trouble than it's worth.
Authors: Michael Paquier, Álvaro Herrera
Review: Noah Misch
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/1caef31d9e550408d0cbc5788a422dcb69736df5
Modified Files
--------------
src/bin/initdb/t/001_initdb.pl | 1 +
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 176 +++++----
src/bin/pg_controldata/t/001_pg_controldata.pl | 11 +-
src/bin/pg_ctl/t/001_start_stop.pl | 9 +-
src/bin/pg_ctl/t/002_status.pl | 13 +-
src/bin/pg_rewind/RewindTest.pm | 216 ++++-------
src/bin/pg_rewind/t/003_extrafiles.pl | 3 +-
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 4 +-
src/bin/scripts/t/010_clusterdb.pl | 22 +-
src/bin/scripts/t/011_clusterdb_all.pl | 13 +-
src/bin/scripts/t/020_createdb.pl | 14 +-
src/bin/scripts/t/030_createlang.pl | 19 +-
src/bin/scripts/t/040_createuser.pl | 18 +-
src/bin/scripts/t/050_dropdb.pl | 14 +-
src/bin/scripts/t/060_droplang.pl | 11 +-
src/bin/scripts/t/070_dropuser.pl | 14 +-
src/bin/scripts/t/080_pg_isready.pl | 9 +-
src/bin/scripts/t/090_reindexdb.pl | 23 +-
src/bin/scripts/t/091_reindexdb_all.pl | 10 +-
src/bin/scripts/t/100_vacuumdb.pl | 17 +-
src/bin/scripts/t/101_vacuumdb_all.pl | 10 +-
src/bin/scripts/t/102_vacuumdb_stages.pl | 13 +-
src/test/perl/PostgresNode.pm | 470 ++++++++++++++++++++++++
src/test/perl/RecursiveCopy.pm | 42 +++
src/test/perl/TestLib.pm | 319 ++++++----------
src/test/ssl/ServerSetup.pm | 34 +-
src/test/ssl/t/001_ssltests.pl | 33 +-
27 files changed, 989 insertions(+), 549 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-12-02 23:20:51 | pgsql: Fix behavior of printTable() and friends with externally-invoked |
Previous Message | Robert Haas | 2015-12-02 13:35:55 | pgsql: Add handling for GatherPath to print_path. |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2015-12-02 21:55:45 | Re: parallel joins, and better parallel explain |
Previous Message | Jeff Janes | 2015-12-02 21:41:43 | Fwd: Another little thing about psql wrapped expanded output |