pgsql: Switch the regression tests of pg_upgrade to use TAP tests - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Switch the regression tests of pg_upgrade to use TAP tests
Date
Msg-id E1na5sq-000EUi-6C@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Switch the regression tests of pg_upgrade to use TAP tests

This simplifies a lot of code in the tests of pg_upgrade without
sacrificing its coverage:
- Removal of test.sh used for builds with make, that has accumulated
over the years tweaks for problems that are solved in a duplicated way
by the centralized TAP framework (initialization of the various
environment variables PG*, port selection).
- Removal of the code in MSVC to test pg_upgrade.  This was roughly a
duplicate of test.sh adapted for Windows, with an extra footprint of
a pg_regress command and all the assumptions behind it.

Support for upgrades with older versions is changed, not removed.
test.sh was able to set up the regression database on the old instance
by launching itself the pg_regress command and a dependency to the
source tree of thd old cluster, with tweaks on the command arguments to
adapt across the versions used.  This created a backward-compatibility
dependency with older pg_regress commands, and recent changes like
d1029bb have made that much more complicated.

Instead, this commit allows tests with older major versions by
specifying a path to a SQL dump (taken with pg_dumpall from the old
cluster's installation) that will be loaded into the old instance to
upgrade instead of running pg_regress, through an optional environment
variable called $olddump.  This requires a second variable called
$oldinstall to point to the base path of the installation of the old
cluster.  This method is more in line with the buildfarm client that
uses a set of static dumps to set up an old instance, so hopefully we
will be able to reuse what is introduced in this commit there.  The last
step of the tests that checks for differences between the two dumps
taken still needs to be improved as it can fail, requiring a manual
lookup at the dumps.  This is not different from the old way of testing
where things could fail at the last step.

Support for EXTRA_REGRESS_OPTS is kept.  vcregress.pl in the MSVC
scripts still handles the test of pg_upgrade with its upgradecheck, and
bincheck is changed to skip pg_upgrade.

Author: Michael Paquier
Reviewed-by: Andrew Dunstan, Andres Freund, Rachel Heaton, Tom Lane,
Discussion: https://postgr.es/m/YJ8xTmLQkotVLpN5@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/322becb6085cb92d3708635eea61b45776bf27b6

Modified Files
--------------
src/bin/pg_upgrade/Makefile            |  21 +--
src/bin/pg_upgrade/TESTING             |  86 ++++------
src/bin/pg_upgrade/t/001_basic.pl      |  11 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 237 ++++++++++++++++++++++++++++
src/bin/pg_upgrade/test.sh             | 279 ---------------------------------
src/tools/msvc/vcregress.pl            |  92 +----------
6 files changed, 290 insertions(+), 436 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Keep plpgsql.h C++-clean.
Next
From: Michael Paquier
Date:
Subject: pgsql: Improve handling and logging of TAP tests for pg_upgrade