pgsql: Refactor Perl test code

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Refactor Perl test code
Дата
Msg-id E1a4FMd-0004iR-Ow@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Refactor Perl test code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: Add handling for GatherPath to print_path.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix behavior of printTable() and friends with externally-invoked