Skip to content

Commit 9d66067

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 6753a5b commit 9d66067

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

src/test/perl/TestLib.pm

+31-11
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,37 @@ BEGIN
9898
delete $ENV{LC_ALL};
9999
$ENV{LC_MESSAGES} = 'C';
100100

101-
delete $ENV{PGCONNECT_TIMEOUT};
102-
delete $ENV{PGDATA};
103-
delete $ENV{PGDATABASE};
104-
delete $ENV{PGHOSTADDR};
105-
delete $ENV{PGREQUIRESSL};
106-
delete $ENV{PGSERVICE};
107-
delete $ENV{PGSSLMODE};
108-
delete $ENV{PGUSER};
109-
delete $ENV{PGPORT};
110-
delete $ENV{PGHOST};
111-
delete $ENV{PG_COLOR};
101+
my @envkeys = qw (
102+
PGCHANNELBINDING
103+
PGCLIENTENCODING
104+
PGCONNECT_TIMEOUT
105+
PGDATA
106+
PGDATABASE
107+
PGGSSENCMODE
108+
PGGSSLIB
109+
PGHOSTADDR
110+
PGKRBSRVNAME
111+
PGPASSFILE
112+
PGPASSWORD
113+
PGREQUIREPEER
114+
PGREQUIRESSL
115+
PGSERVICE
116+
PGSERVICEFILE
117+
PGSSLCERT
118+
PGSSLCRL
119+
PGSSLCRLDIR
120+
PGSSLKEY
121+
PGSSLMAXPROTOCOLVERSION
122+
PGSSLMINPROTOCOLVERSION
123+
PGSSLMODE
124+
PGSSLROOTCERT
125+
PGTARGETSESSIONATTRS
126+
PGUSER
127+
PGPORT
128+
PGHOST
129+
PG_COLOR
130+
);
131+
delete @ENV{@envkeys};
112132

113133
$ENV{PGAPPNAME} = basename($0);
114134

0 commit comments

Comments
 (0)