The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4218

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: St├ęphane Graber <stgra...@ubuntu.com>
From 609e2dd8b12834b2fba17c210be3cfe546125d7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 2 Feb 2018 15:18:22 +0100
Subject: [PATCH] tests: Fix race in proxy test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: St├ęphane Graber <stgra...@ubuntu.com>
---
 test/suites/proxy.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/suites/proxy.sh b/test/suites/proxy.sh
index 9017c253e..01123ad0c 100755
--- a/test/suites/proxy.sh
+++ b/test/suites/proxy.sh
@@ -1,4 +1,7 @@
 test_proxy_device() {
+  ensure_import_testimage
+  ensure_has_localhost_remote "${LXD_ADDR}"
+
   MESSAGE="Proxy device test string"
   HOST_TCP_PORT=$(local_tcp_port)
 
@@ -7,8 +10,7 @@ test_proxy_device() {
   nsenter -n -t "$(lxc query /1.0/containers/proxyTester/state | jq .pid)" -- 
nc -6 -l 4321 > proxyTest.out &
   sleep 2
 
-  echo "${MESSAGE}" | nc 127.0.0.1 "${HOST_TCP_PORT}" &
-  sleep 1
+  echo "${MESSAGE}" | nc -N -w1 127.0.0.1 "${HOST_TCP_PORT}"
 
   if [ "$(cat proxyTest.out)" != "${MESSAGE}" ]; then
     echo "Proxy device did not properly send data from host to container"
@@ -21,8 +23,7 @@ test_proxy_device() {
   nsenter -n -t "$(lxc query /1.0/containers/proxyTester/state | jq .pid)" -- 
nc -6 -l 4321 > proxyTest.out &
   sleep 2
 
-  echo "${MESSAGE}" | nc 127.0.0.1 "${HOST_TCP_PORT}" &
-  sleep 1
+  echo "${MESSAGE}" | nc -N -w1 127.0.0.1 "${HOST_TCP_PORT}"
 
   if [ "$(cat proxyTest.out)" != "${MESSAGE}" ]; then
     echo "Proxy device did not properly restart on container restart"
@@ -35,8 +36,7 @@ test_proxy_device() {
   nsenter -n -t "$(lxc query /1.0/containers/proxyTester/state | jq .pid)" -- 
nc -6 -l 1337 > proxyTest.out &
   sleep 2
 
-  echo "${MESSAGE}" | nc 127.0.0.1 "${HOST_TCP_PORT}" &
-  sleep 1
+  echo "${MESSAGE}" | nc -N -w1 127.0.0.1 "${HOST_TCP_PORT}"
 
   if [ "$(cat proxyTest.out)" != "${MESSAGE}" ]; then
     echo "Proxy device did not properly restart when config was updated"
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to