Hi all,

I have run the TAP tests with an instance of Postgres locally set at
port 5432 on Windows, to notice that 001_start_stop.pl fails various
tests because the test tries to use the default port for the node
initialized with pg_ctl.  The problem can get fixed easily by
assigning a random port number to that instance.

It could potentially become a problem if parallel TAP tests run in
parallel on Windows while initializing the node because of a port
conflict, but that's actually already a problem now for all the tests
as all nodes listen to 127.0.0.1 in this case.  This cannot happen on
*nix simply because we use a unique unix domain path, so even if ports
conflict things are able to work. 

Attached is a patch to fix this issue, that I would like to
back-patch down to 9.4 where the issue can show up.

Any objections?
--
Michael
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index e5d46a6f25..6a1619e171 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -22,8 +22,10 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
 	'pg_ctl initdb');
 command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
+my $node_port = get_free_port();
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
+print $conf "port = $node_port\n";
 print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
   if defined $ENV{TEMP_CONFIG};
 

Attachment: signature.asc
Description: PGP signature

Reply via email to