PostgresNode: wrap correctly around port number range end
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 7 Dec 2015 23:06:21 +0000 (20:06 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 7 Dec 2015 23:06:21 +0000 (20:06 -0300)
Per note from Tom Lane

src/test/perl/PostgresNode.pm

index b18c6bf33c65f8314add9cbae9dbde3442254053..7b6ddf25de9c202ad30101fef45599314ad3ad46 100644 (file)
@@ -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 ]))
        {