From 6b9e8816d19c3e3f7c19c08a94319b6d91b30bee Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 3 Nov 2015 15:31:17 +0000 Subject: [PATCH 1/2] Wait for proxy to become available after docker is restarted --- test/640_proxy_restart_reattaches_test.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/640_proxy_restart_reattaches_test.sh b/test/640_proxy_restart_reattaches_test.sh index fc1df46c..c3e163fd 100755 --- a/test/640_proxy_restart_reattaches_test.sh +++ b/test/640_proxy_restart_reattaches_test.sh @@ -11,6 +11,18 @@ check_attached() { assert_dns_record $HOST1 c1 $NAME $C2 } +wait_for_proxy() { + for i in $(seq 1 120); do + echo "Waiting for proxy to start" + if proxy docker_on $1 info > /dev/null 2>&1 ; then + return + fi + sleep 1 + done + echo "Timed out waiting for proxy to start" >&2 + exit 1 +} + start_suite "Proxy restart reattaches networking to containers" WEAVE_DOCKER_ARGS=--restart=always WEAVEPROXY_DOCKER_ARGS=--restart=always weave_on $HOST1 launch @@ -32,7 +44,7 @@ check_attached # Restart docker itself, using different commands for systemd- and upstart-managed. run_on $HOST1 sh -c "command -v systemctl >/dev/null && sudo systemctl restart docker || sudo service docker restart" -sleep 10 +wait_for_proxy $HOST1 check_attached # Restarting proxy shouldn't kill unattachable containers From 06eaac8690e5374cb724179003b924cbb6562f4b Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 3 Nov 2015 15:38:14 +0000 Subject: [PATCH 2/2] Don't assert ethwe carrier via the proxy The test script runs commands inside containers via docker exec to ensure the ethwe carrier is up. We must not run these commands via the proxy because it will interpose weavewait, which will block forever if attachment has failed (e.g. due to #1556). --- test/640_proxy_restart_reattaches_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/640_proxy_restart_reattaches_test.sh b/test/640_proxy_restart_reattaches_test.sh index c3e163fd..59bc91f8 100755 --- a/test/640_proxy_restart_reattaches_test.sh +++ b/test/640_proxy_restart_reattaches_test.sh @@ -7,7 +7,7 @@ C2=10.2.0.34 NAME=seetwo.weave.local check_attached() { - assert_raises "proxy exec_on $HOST1 c2 $CHECK_ETHWE_UP" + assert_raises "exec_on $HOST1 c2 $CHECK_ETHWE_UP" assert_dns_record $HOST1 c1 $NAME $C2 } @@ -51,6 +51,6 @@ check_attached proxy_start_container $HOST1 -di --name=c3 --restart=always # Use ipam, so it won't be attachable w/o weave weave_on $HOST1 stop weave_on $HOST1 launch-proxy -assert_raises "proxy exec_on $HOST1 c3 $CHECK_ETHWE_UP" +assert_raises "exec_on $HOST1 c3 $CHECK_ETHWE_UP" end_suite