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: Refactor Perl test code
Date: Wed, 02 Dec 2015 21:55:03 +0000
Message-ID: <E1a4FMd-0004iR-Ow@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

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(-)


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


view thread (11+ messages)  latest in thread

Message-ID: <E1a4FMd-0004iR-Ow@gemulon.postgresql.org>
Permalink:  ../E1a4FMd-0004iR-Ow@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1a4FMd-0004iR-Ow@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: Refactor Perl test code
  In-Reply-To: <E1a4FMd-0004iR-Ow@gemulon.postgresql.org>
  References: <E1a4FMd-0004iR-Ow@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