aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-12-03 13:01:06 +0900
committerMichael Paquier <michael@paquier.xyz>2019-12-03 13:01:06 +0900
commite5532f194c18e6c12c3aa9cb07291973dc8adb39 (patch)
tree443aea44bb53b9965c63cfbc15b9403fbf3f2b86 /src
parent55a1954da16e041f895e5c3a6abff13c5e3a4a2f (diff)
downloadpostgresql-e5532f194c18e6c12c3aa9cb07291973dc8adb39.tar.gz
postgresql-e5532f194c18e6c12c3aa9cb07291973dc8adb39.zip
Fix failures with TAP tests of pg_ctl on Windows
On Windows, all the hosts spawned by the TAP tests bind to 127.0.0.1. Hence, if there is a port conflict, starting a cluster would immediately fail. One of the test scripts of pg_ctl initializes a node without PostgresNode.pm, using the default port 5432. This could cause unexpected startup failures in the tests if an independent server was up and running on the same host (the reverse is also possible, though more unlikely). Fix this issue by assigning properly a free port to the node configured, in the same range used as for the other nodes part of the tests. Author: Michael Paquier Reviewed-by: Andrew Dunstan Discussion: https://postgr.es/m/20191202031444.GC1696@paquier.xyz Backpatch-through: 11
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_ctl/t/001_start_stop.pl2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index e5d46a6f257..6a1619e171b 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};