Skip to content

Commit a886e2f

Browse files
committed
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
1 parent 3eca185 commit a886e2f

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

src/test/perl/TestLib.pm

+25-10
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,31 @@ BEGIN
5151
delete $ENV{LC_ALL};
5252
$ENV{LC_MESSAGES} = 'C';
5353

54-
delete $ENV{PGCONNECT_TIMEOUT};
55-
delete $ENV{PGDATA};
56-
delete $ENV{PGDATABASE};
57-
delete $ENV{PGHOSTADDR};
58-
delete $ENV{PGREQUIRESSL};
59-
delete $ENV{PGSERVICE};
60-
delete $ENV{PGSSLMODE};
61-
delete $ENV{PGUSER};
62-
delete $ENV{PGPORT};
63-
delete $ENV{PGHOST};
54+
my @envkeys = qw (
55+
PGCLIENTENCODING
56+
PGCONNECT_TIMEOUT
57+
PGDATA
58+
PGDATABASE
59+
PGGSSLIB
60+
PGHOSTADDR
61+
PGKRBSRVNAME
62+
PGPASSFILE
63+
PGPASSWORD
64+
PGREQUIREPEER
65+
PGREQUIRESSL
66+
PGSERVICE
67+
PGSERVICEFILE
68+
PGSSLCERT
69+
PGSSLCRL
70+
PGSSLCRLDIR
71+
PGSSLKEY
72+
PGSSLMODE
73+
PGSSLROOTCERT
74+
PGUSER
75+
PGPORT
76+
PGHOST
77+
);
78+
delete @ENV{@envkeys};
6479

6580
# Must be set early
6681
$windows_os = $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys';

0 commit comments

Comments
 (0)