From 7d0b1cec61eab0fc7fac69a89c66e5a14f2704ac Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Thu, 3 Mar 2016 20:22:47 +0000 Subject: [PATCH] Fix integration test --- integration/300_internet_edge_test.sh | 4 +--- integration/config.sh | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/integration/300_internet_edge_test.sh b/integration/300_internet_edge_test.sh index eff59e43c..614123fcd 100755 --- a/integration/300_internet_edge_test.sh +++ b/integration/300_internet_edge_test.sh @@ -24,9 +24,7 @@ do_connections& wait_for_containers $HOST1 60 nginx "The Internet" -has_container $HOST1 nginx -has_container $HOST1 "The Internet" -has_connection containers $HOST1 "The Internet" nginx +has_connection_by_id containers $HOST1 "in-theinternet" $(node_id containers $HOST1 nginx) kill %do_connections diff --git a/integration/config.sh b/integration/config.sh index 5e6b69364..251c436f1 100644 --- a/integration/config.sh +++ b/integration/config.sh @@ -59,14 +59,13 @@ container_id() { } # this checks we have an edge from container 1 to container 2 -has_connection() { +has_connection_by_id() { local view="$1" local host="$2" - local from="$3" - local to="$4" + local from_id="$3" + local to_id="$4" local timeout="${5:-60}" - local from_id=$(node_id "${view}" "${host}" "${from}") - local to_id=$(node_id "${view}" "${host}" "${to}") + for i in $(seq $timeout); do local nodes="$(curl -s http://$host:4040/api/topology/${view}?system=show)" local edge=$(echo "$nodes" | jq -r ".nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])" 2>/dev/null) @@ -82,6 +81,18 @@ has_connection() { assert "curl -s http://$host:4040/api/topology/${view}?system=show | jq -r '.nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])'" true } +has_connection() { + local view="$1" + local host="$2" + local from="$3" + local to="$4" + local timeout="${5:-60}" + local from_id="$(node_id "${view}" "${host}" "${from}")" + local to_id="$(node_id "${view}" "${host}" "${to}")" + + has_connection_by_id "${view}" "${host}" "${from_id}" "${to_id}" "${timeout}" +} + wait_for() { local view="$1" local host="$2"