summaryrefslogtreecommitdiff
path: root/src/test/perl/TestLib.pm
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-06-03 11:51:56 +0900
committerMichael Paquier <michael@paquier.xyz>2021-06-03 11:51:56 +0900
commitc63bb6950735103fa6528081014955d065c8ab64 (patch)
treeb7656c9c9e3cca0964b953e2f2acb576b67a1c69 /src/test/perl/TestLib.pm
parent39862dde4beecdf1c5f84a20fe3bb6f4ba928edb (diff)
Ignore more environment variables in TAP tests
Various environment variables were not getting reset in the TAP tests, which would cause failures depending on the tests or the environment variables involved. For example, PGSSL{MAX,MIN}PROTOCOLVERSION could cause failures in the SSL tests. Even worse, a junk value of PGCLIENTENCODING makes a server startup fail. The list of variables reset is adjusted in each stable branch depending on what is supported. While on it, simplify a bit the code per a suggestion from Andrew Dunstan, using a list of variables instead of doing single deletions. Reviewed-by: Andrew Dunstan, Daniel Gustafsson Discussion: https://postgr.es/m/YLbjjRpucIeZ78VQ@paquier.xyz Backpatch-through: 9.6
Diffstat (limited to 'src/test/perl/TestLib.pm')
-rw-r--r--src/test/perl/TestLib.pm36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index e99c62a0d72..a25998ed9d2 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -56,16 +56,32 @@ BEGIN
delete $ENV{LC_ALL};
$ENV{LC_MESSAGES} = 'C';
- delete $ENV{PGCONNECT_TIMEOUT};
- delete $ENV{PGDATA};
- delete $ENV{PGDATABASE};
- delete $ENV{PGHOSTADDR};
- delete $ENV{PGREQUIRESSL};
- delete $ENV{PGSERVICE};
- delete $ENV{PGSSLMODE};
- delete $ENV{PGUSER};
- delete $ENV{PGPORT};
- delete $ENV{PGHOST};
+ my @envkeys = qw (
+ PGCLIENTENCODING
+ PGCONNECT_TIMEOUT
+ PGDATA
+ PGDATABASE
+ PGGSSLIB
+ PGHOSTADDR
+ PGKRBSRVNAME
+ PGPASSFILE
+ PGPASSWORD
+ PGREQUIREPEER
+ PGREQUIRESSL
+ PGSERVICE
+ PGSERVICEFILE
+ PGSSLCERT
+ PGSSLCRL
+ PGSSLCRLDIR
+ PGSSLKEY
+ PGSSLMODE
+ PGSSLROOTCERT
+ PGTARGETSESSIONATTRS
+ PGUSER
+ PGPORT
+ PGHOST
+ );
+ delete @ENV{@envkeys};
$ENV{PGAPPNAME} = $0;