Fix searchpath and module location for pg_rewind and ssl TAP tests
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 7 Feb 2019 15:22:49 +0000 (10:22 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 7 Feb 2019 16:09:08 +0000 (11:09 -0500)
The modules RewindTest.pm and ServerSetup.pm are really only useful for
TAP tests, so they really belong in the TAP test directories. In
addition, ServerSetup.pm is renamed to SSLServer.pm.

The test scripts have their own directories added to the search path so
that the relocated modules will be found, regardless of where the tests
are run from, even on modern perl where "." is no longer in the
searchpath.

Discussion: https://postgr.es/m/e4b0f366-269c-73c3-9c90-d9cb0f4db1f9@2ndQuadrant.com

Backpatch as appropriate to 9.5

src/bin/pg_rewind/t/001_basic.pl
src/bin/pg_rewind/t/002_databases.pl
src/bin/pg_rewind/t/003_extrafiles.pl
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
src/bin/pg_rewind/t/005_same_timeline.pl
src/bin/pg_rewind/t/RewindTest.pm [moved from src/bin/pg_rewind/RewindTest.pm with 100% similarity]
src/test/ssl/t/001_ssltests.pl
src/test/ssl/t/002_scram.pl
src/test/ssl/t/SSLServer.pm [moved from src/test/ssl/ServerSetup.pm with 99% similarity]

index 53dbf45be29d394e53e4bd78710e72f70f257058..115192170e56819ad777053f65c0f45d227d8c17 100644 (file)
@@ -3,6 +3,9 @@ use warnings;
 use TestLib;
 use Test::More tests => 10;
 
+use FindBin;
+use lib $FindBin::RealBin;
+
 use RewindTest;
 
 sub run_test
index 2c9e427831139ac4cc7235298fcb76965bb80bd2..6dc05720a1e55fe5c337c2b2bc4d7de76b496006 100644 (file)
@@ -3,6 +3,9 @@ use warnings;
 use TestLib;
 use Test::More tests => 6;
 
+use FindBin;
+use lib $FindBin::RealBin;
+
 use RewindTest;
 
 sub run_test
index 496f38c4570c52eef1d5db41d86f420cab18b7fb..c4040bd5620d5eabb2eceaef9157a5fc64ec2032 100644 (file)
@@ -7,6 +7,9 @@ use Test::More tests => 4;
 
 use File::Find;
 
+use FindBin;
+use lib $FindBin::RealBin;
+
 use RewindTest;
 
 
index 280eceb9929f41791453c47b095921d9bd96e96c..ed1ddb6b60cb4ca19819ca3a321166432b667bfc 100644 (file)
@@ -17,6 +17,9 @@ else
    plan tests => 4;
 }
 
+use FindBin;
+use lib $FindBin::RealBin;
+
 use RewindTest;
 
 sub run_test
index 0e334ee191aa24f919d2202b8f06eee0c3724642..40dbc44caa3ac1077611ccb0944614ee84e1656d 100644 (file)
@@ -3,6 +3,9 @@ use warnings;
 use TestLib;
 use Test::More tests => 1;
 
+use FindBin;
+use lib $FindBin::RealBin;
+
 use RewindTest;
 
 # Test that running pg_rewind if the two clusters are on the same
index 915007805e5c4e4b0ed2c8c94c9034c3d826217c..2f6dfad23c4eed8f7c075049e75f585032a48f19 100644 (file)
@@ -3,9 +3,14 @@ use warnings;
 use PostgresNode;
 use TestLib;
 use Test::More;
-use ServerSetup;
+
 use File::Copy;
 
+use FindBin;
+use lib $FindBin::RealBin;
+
+use SSLServer;
+
 if ($ENV{with_openssl} eq 'yes')
 {
    plan tests => 71;
index d45b9c5db3ad8d45452c99241fb94795d9df5629..e636efa54dc88f5f7028c417c8f7e0d33c54b32a 100644 (file)
@@ -5,9 +5,14 @@ use warnings;
 use PostgresNode;
 use TestLib;
 use Test::More;
-use ServerSetup;
+
 use File::Copy;
 
+use FindBin;
+use lib $FindBin::RealBin;
+
+use SSLServer;
+
 if ($ENV{with_openssl} ne 'yes')
 {
    plan skip_all => 'SSL not supported by this build';
similarity index 99%
rename from src/test/ssl/ServerSetup.pm
rename to src/test/ssl/t/SSLServer.pm
index 5acba52310f104febb4fe5722d8fcf7b6218931b..b1b5b7f0b34d0e27e949cdfa046d76fd8e43266e 100644 (file)
@@ -24,7 +24,7 @@
 # explicitly because an invalid sslcert or sslrootcert, respectively,
 # causes those to be ignored.)
 
-package ServerSetup;
+package SSLServer;
 
 use strict;
 use warnings;