From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Mon, 7 Dec 2015 23:06:21 +0000 (-0300)
Subject: PostgresNode: wrap correctly around port number range end
X-Git-Tag: REL9_6_BETA1~1031
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ac5d9b31637b1856c7ac9cb625bcca694a2790a;p=postgresql

PostgresNode: wrap correctly around port number range end

Per note from Tom Lane
---

diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index b18c6bf33c..7b6ddf25de 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -321,7 +321,8 @@ sub get_new_node
 
 	while ($found == 0)
 	{
-		$port++;
+		# wrap correctly around range end
+		$port = 49152 if ++$port >= 65536;
 		print "# Checking for port $port\n";
 		if (!TestLib::run_log([ 'pg_isready', '-p', $port ]))
 		{