From f1b7b7be59272def27f14acf75f242859b5b75e7 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Mon, 7 Dec 2015 18:25:24 -0800 Subject: [PATCH] fix tests Signed-off-by: Victor Vieux --- test/integration/discovery/consul.bats | 2 +- test/integration/discovery/etcd.bats | 2 +- test/integration/discovery/file.bats | 2 +- test/integration/discovery/zk.bats | 2 +- test/integration/helpers.bash | 14 ++++++++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/integration/discovery/consul.bats b/test/integration/discovery/consul.bats index b883c2b39c..f3348a81ab 100644 --- a/test/integration/discovery/consul.bats +++ b/test/integration/discovery/consul.bats @@ -99,7 +99,7 @@ function teardown() { swarm_join "$DISCOVERY" # Start a manager. It should keep retrying - swarm_manage "$DISCOVERY" + swarm_manage_no_wait "$DISCOVERY" # Now start the store start_store diff --git a/test/integration/discovery/etcd.bats b/test/integration/discovery/etcd.bats index 15b3501e1a..bf5f306dd8 100644 --- a/test/integration/discovery/etcd.bats +++ b/test/integration/discovery/etcd.bats @@ -106,7 +106,7 @@ function teardown() { swarm_join "$DISCOVERY" # Start a manager. It should keep retrying - swarm_manage "$DISCOVERY" + swarm_manage_no_wait "$DISCOVERY" # Now start the store start_store diff --git a/test/integration/discovery/file.bats b/test/integration/discovery/file.bats index 35bb1709fc..816a730b9d 100644 --- a/test/integration/discovery/file.bats +++ b/test/integration/discovery/file.bats @@ -82,7 +82,7 @@ function setup_discovery_file() { start_docker 2 # Start a manager. It should keep retrying - swarm_manage "$DISCOVERY" + swarm_manage_no_wait "$DISCOVERY" # Now create the discovery file. setup_discovery_file diff --git a/test/integration/discovery/zk.bats b/test/integration/discovery/zk.bats index 0da74ffb54..825b02e2a3 100644 --- a/test/integration/discovery/zk.bats +++ b/test/integration/discovery/zk.bats @@ -99,7 +99,7 @@ function teardown() { swarm_join "$DISCOVERY" # Start a manager. It should keep retrying - swarm_manage "$DISCOVERY" + swarm_manage_no_wait "$DISCOVERY" # Now start the store start_store diff --git a/test/integration/helpers.bash b/test/integration/helpers.bash index ca2ebe958b..9307767608 100644 --- a/test/integration/helpers.bash +++ b/test/integration/helpers.bash @@ -95,8 +95,17 @@ function discovery_check_swarm_info() { retry 10 1 eval "docker -H $host info | grep -q -e \"Nodes: $total\" -e \"Offers: $total\"" } -# Start the swarm manager in background. function swarm_manage() { + local i=${#SWARM_MANAGE_PID[@]} + + swarm_manage_no_wait "$@" + + # Wait for nodes to be discovered + discovery_check_swarm_info "${#HOSTS[@]}" "${SWARM_HOSTS[$i]}" +} + +# Start the swarm manager in background. +function swarm_manage_no_wait() { local discovery if [ $# -eq 0 ]; then discovery=`join , ${HOSTS[@]}` @@ -114,9 +123,6 @@ function swarm_manage() { # Wait for the Manager to be reachable wait_until_reachable "$host" - - # Wait for nodes to be discovered - discovery_check_swarm_info "${#HOSTS[@]}" "$host" } # swarm join every engine created with `start_docker`.