[lxc-devel] [lxd/master] tests: Fix race in proxy test
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Feb 2 14:19:27 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180202/0c47d5a9/attachment.bin>
-------------- next part --------------
From 609e2dd8b12834b2fba17c210be3cfe546125d7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at 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 <stgraber at 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"
More information about the lxc-devel
mailing list