Make integration tests more robust

This commit is contained in:
Alfonso Acosta
2017-01-19 10:06:32 +00:00
parent 57300c6bec
commit 3ed02d9a9a

View File

@@ -71,8 +71,8 @@ has_connection_by_id() {
for i in $(seq "$timeout"); do
local nodes
local edge
edge=$(echo "$nodes" | jq -r ".nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])" 2>/dev/null)
nodes="$(curl -s "http://$host:4040/api/topology/${view}?system=show")"
edge=$(echo "$nodes" | (jq -r ".nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])" || true) 2>/dev/null)
nodes=$(curl -s "http://$host:4040/api/topology/${view}?system=show" || true)
if [ "$edge" = "true" ]; then
echo "Found edge $from -> $to after $i secs"
assert "curl -s http://$host:4040/api/topology/${view}?system=show | jq -r '.nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])'" true
@@ -109,7 +109,7 @@ wait_for() {
for i in $(seq "${timeout}"); do
local nodes
local found=0
nodes="$(curl -s "http://$host:4040/api/topology/${view}?system=show")"
nodes=$(curl -s "http://$host:4040/api/topology/${view}?system=show" || true)
for name in "$@"; do
local count
count=$(echo "${nodes}" | jq -r "[.nodes[] | select(.label == \"${name}\")] | length")