From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E152E71B59 for ; Fri, 11 Jun 2021 17:55:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CD4E615132 for ; Fri, 11 Jun 2021 17:55:00 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id F23A315117 for ; Fri, 11 Jun 2021 17:54:59 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9331A42F91 for ; Fri, 11 Jun 2021 17:54:59 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Fri, 11 Jun 2021 17:54:47 +0200 Message-Id: <20210611155447.9162-3-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210611155447.9162-1-s.ivanov@proxmox.com> References: <20210611155447.9162-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.916 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-api 2/2] tests: greylist: retry connecting 3 times X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jun 2021 15:55:00 -0000 Sometimes pmgpolicy is not done starting up when we try connecting. Sadly strace on test_greylist.pl makes the problem disappear. Looping 3 times should work robustly. Signed-off-by: Stoiko Ivanov --- src/tests/test_greylist.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/tests/test_greylist.pl b/src/tests/test_greylist.pl index 3aa613f..6a5a11a 100755 --- a/src/tests/test_greylist.pl +++ b/src/tests/test_greylist.pl @@ -44,10 +44,16 @@ sub reset_gldb { reset_gldb(); -my $sock = IO::Socket::INET->new( - PeerAddr => '127.0.0.1', - PeerPort => $testport) || - die "unable to open socket - $!"; + +my $sock; +for (my $tries = 0 ; $tries < 3 ; $tries++) { + $sock = IO::Socket::INET->new( + PeerAddr => '127.0.0.1', + PeerPort => $testport); + last if $sock; + sleep 1; +} +die "unable to open socket - $!" if !$sock; $/ = "\n\n"; -- 2.20.1