From 5d0cf93d3b6a533f2f1224a72be874dd3a16b935 Mon Sep 17 00:00:00 2001
From: Christoph Berg <myon@debian.org>
Date: Fri, 22 Jul 2022 14:15:52 +0200
Subject: [PATCH] t/100_upgrade_scripts.t: Spray more debugging output

---
 t/100_upgrade_scripts.t | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/t/100_upgrade_scripts.t b/t/100_upgrade_scripts.t
index ca665087..f3803139 100644
--- a/t/100_upgrade_scripts.t
+++ b/t/100_upgrade_scripts.t
@@ -7,7 +7,7 @@ use TestLib;
 
 my @versions = ($MAJORS[-1]);
 
-use Test::More tests => 29;
+use Test::More tests => 31;
 use PgCommon;
 
 $ENV{DEBUG_NEXT_FREE_PORT} = 1;
@@ -19,6 +19,8 @@ if ($ENV{LD_PRELOAD} and $ENV{LD_PRELOAD} =~ /eatmydata/) {
         split (/\s+/, $ENV{LD_PRELOAD}));
 }
 
+$ENV{DEBUG_NEXT_FREE_PORT} = 1;
+
 my $shellaction = '#!/bin/sh
 S=`basename $0`
 SQL="INSERT INTO log VALUES (\'$S $1 $2 $3\')"
@@ -45,6 +47,10 @@ my %test_sql_scripts = (
 
 # create clusters
 foreach my $v (@versions) {
+    system "ss --no-header -ap 'sport >= 5432 and sport <= 5439'" if exists $ENV{DEBUG_NEXT_FREE_PORT};
+    is next_free_port, 5432, "next free port is 5432";
+    sleep 5;
+    is next_free_port, 5432, "next free port is 5432";
     is ((system "pg_createcluster $v main --start >/dev/null"), 0, "pg_createcluster $v main");
     like_program_out 'postgres', 'pg_lsclusters -h', 0, qr/$v\s*main.*5432.*online/, 'cluster was created';
     is_program_out 'postgres', "createdb --cluster $v/main db1", 0, ($v < 8.3 ? "CREATE DATABASE\n" : '');
-- 
GitLab