Skip to content

Commit 36ac9f6

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 dc27215 commit 36ac9f6

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/test/perl/TestLib.pm

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,32 @@ BEGIN
6262
delete $ENV{LC_ALL};
6363
$ENV{LC_MESSAGES} = 'C';
6464

65-
delete $ENV{PGCONNECT_TIMEOUT};
66-
delete $ENV{PGDATA};
67-
delete $ENV{PGDATABASE};
68-
delete $ENV{PGHOSTADDR};
69-
delete $ENV{PGREQUIRESSL};
70-
delete $ENV{PGSERVICE};
71-
delete $ENV{PGSSLMODE};
72-
delete $ENV{PGUSER};
73-
delete $ENV{PGPORT};
74-
delete $ENV{PGHOST};
65+
my @envkeys = qw (
66+
PGCLIENTENCODING
67+
PGCONNECT_TIMEOUT
68+
PGDATA
69+
PGDATABASE
70+
PGGSSLIB
71+
PGHOSTADDR
72+
PGKRBSRVNAME
73+
PGPASSFILE
74+
PGPASSWORD
75+
PGREQUIREPEER
76+
PGREQUIRESSL
77+
PGSERVICE
78+
PGSERVICEFILE
79+
PGSSLCERT
80+
PGSSLCRL
81+
PGSSLCRLDIR
82+
PGSSLKEY
83+
PGSSLMODE
84+
PGSSLROOTCERT
85+
PGTARGETSESSIONATTRS
86+
PGUSER
87+
PGPORT
88+
PGHOST
89+
);
90+
delete @ENV{@envkeys};
7591

7692
$ENV{PGAPPNAME} = basename($0);
7793

0 commit comments

Comments
 (0)