Make sure to run pg_isready on correct port
authorAndrew Dunstan
Fri, 12 Jul 2024 22:29:15 +0000 (18:29 -0400)
committerAndrew Dunstan
Sat, 13 Jul 2024 12:10:44 +0000 (08:10 -0400)
The current code can have pg_isready unexpectedly succeed if there is a
server running on the default port. To avoid this we delay running the
test until after a node has been created but before it starts, and then
use that node's port, so we are fairly sure there is nothing running on
the port.

Backpatch to all live branches.

src/bin/scripts/t/080_pg_isready.pl

index c45ca6666f9fa70d8deac9f0334cc08acae6cd94..a60b4498479f5bcf4f1646b017069f47b2776ab2 100644 (file)
@@ -12,10 +12,11 @@ program_help_ok('pg_isready');
 program_version_ok('pg_isready');
 program_options_handling_ok('pg_isready');
 
-command_fails(['pg_isready'], 'fails with no server running');
-
 my $node = PostgreSQL::Test::Cluster->new('main');
 $node->init;
+
+$node->command_fails(['pg_isready'], 'fails with no server running');
+
 $node->start;
 
 $node->command_ok(