From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api 2/2] tests: greylist: retry connecting 3 times
Date: Fri, 11 Jun 2021 17:54:47 +0200 [thread overview]
Message-ID: <20210611155447.9162-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20210611155447.9162-1-s.ivanov@proxmox.com>
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 <s.ivanov@proxmox.com>
---
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
next prev parent reply other threads:[~2021-06-11 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-11 15:54 [pmg-devel] [PATCH pmg-api 0/2] remove unused greylist table column and make test_gl more robust Stoiko Ivanov
2021-06-11 15:54 ` [pmg-devel] [PATCH pmg-api 1/2] greylisting: drop unneeded Host column form cgreylist table Stoiko Ivanov
2021-06-11 15:54 ` Stoiko Ivanov [this message]
2021-06-16 11:04 ` [pmg-devel] [PATCH pmg-api 0/2] remove unused greylist table column and make test_gl more robust Dominik Csapak
2021-06-16 12:21 ` [pmg-devel] applied-series: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210611155447.9162-3-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox