[lxc-devel] [lxd/master] tests: Add sleep when getting TCP port

monstermunchkin on Github lxc-bot at linuxcontainers.org
Wed Jul 4 13:23:12 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 411 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180704/8bd69408/attachment.bin>
-------------- next part --------------
From 1710f7f528ca361a61eb065d2ea84ef550600a61 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 4 Jul 2018 14:16:34 +0200
Subject: [PATCH] tests: Add sleep when getting TCP port

This fixes random hangs when running the test suite.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 test/includes/net.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/includes/net.sh b/test/includes/net.sh
index e6e3c2757..855d7389e 100644
--- a/test/includes/net.sh
+++ b/test/includes/net.sh
@@ -8,6 +8,7 @@ local_tcp_port() {
     while true; do
         port=$(shuf -i 10000-32768 -n 1)
         nc -l 127.0.0.1 "${port}" >/dev/null 2>&1 &
+        sleep 1
         pid=$!
         kill "${pid}" >/dev/null 2>&1 || continue
         wait "${pid}" || true


More information about the lxc-devel mailing list