diff --git a/integration/300_internet_edge_test.sh b/integration/300_internet_edge_test.sh index cb56e038b0..3e5b07a1b9 100755 --- a/integration/300_internet_edge_test.sh +++ b/integration/300_internet_edge_test.sh @@ -4,6 +4,12 @@ start_suite "Test short lived connections from the Internet" +if ! echo "$HOST1" | grep "us-central1-a"; then + echo "Skipping; test needs to be run against VMs on GCE." + scope_end_suite + exit +fi + weave_on $HOST1 launch scope_on $HOST1 launch docker_on $HOST1 run -d -p 80:80 --name nginx nginx @@ -20,7 +26,7 @@ wait_for_containers $HOST1 60 nginx "The Internet" has_container $HOST1 nginx has_container $HOST1 "The Internet" -has_connection $HOST1 "The Internet" nginx 60 +has_connection $HOST1 "The Internet" nginx kill %do_connections diff --git a/integration/310_container_to_container_edge_test.sh b/integration/310_container_to_container_edge_test.sh index 87327e34e6..ec19d8ca91 100755 --- a/integration/310_container_to_container_edge_test.sh +++ b/integration/310_container_to_container_edge_test.sh @@ -7,7 +7,10 @@ start_suite "Test short lived connections between containers" weave_on $HOST1 launch scope_on $HOST1 launch weave_on $HOST1 run -d --name nginx nginx -weave_on $HOST1 run -d --name client alpine /bin/sh -c "while true; do wget http://nginx.weave.local:80/ >/dev/null; sleep 1; done" +weave_on $HOST1 run -d --name client alpine /bin/sh -c "while true; do \ + wget http://nginx.weave.local:80/ >/dev/null || true; \ + sleep 1; \ +done" wait_for_containers $HOST1 60 nginx client diff --git a/integration/320_container_edge_cross_host_2_test.sh b/integration/320_container_edge_cross_host_2_test.sh index 67d1b48865..b13cd097c4 100755 --- a/integration/320_container_edge_cross_host_2_test.sh +++ b/integration/320_container_edge_cross_host_2_test.sh @@ -11,7 +11,10 @@ scope_on $HOST1 launch scope_on $HOST2 launch weave_on $HOST1 run -d --name nginx nginx -weave_on $HOST2 run -d --name client alpine /bin/sh -c "while true; do wget http://nginx.weave.local:80/ >/dev/null; sleep 1; done" +weave_on $HOST2 run -d --name client alpine /bin/sh -c "while true; do \ + wget http://nginx.weave.local:80/ >/dev/null || true; \ + sleep 1; \ +done" sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports diff --git a/integration/config.sh b/integration/config.sh index daf72dfbd1..274813ab73 100644 --- a/integration/config.sh +++ b/integration/config.sh @@ -57,13 +57,13 @@ has_connection() { local host="$1" local from="$2" local to="$3" - local timeout="${4:-10}" + local timeout="${4:-60}" local from_id=$(container_id "$host" "$from") local to_id=$(container_id "$host" "$to") for i in $(seq $timeout); do local containers="$(curl -s http://$host:4040/api/topology/containers?system=show)" - local edge=$(echo "$containers" | jq -r ".nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])") + local edge=$(echo "$containers" | jq -r ".nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])" 2>/dev/null) if [ "$edge" = "true" ]; then echo "Found edge $from -> $to after $i secs" assert "curl -s http://$host:4040/api/topology/containers?system=show | jq -r '.nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])'" true @@ -72,7 +72,7 @@ has_connection() { sleep 1 done - echo "Failed to fing edge $from -> $to after $timeout secs" + echo "Failed to find edge $from -> $to after $timeout secs" assert "curl -s http://$host:4040/api/topology/containers?system=show | jq -r '.nodes[\"$from_id\"].adjacency | contains([\"$to_id\"])'" true } @@ -86,7 +86,7 @@ wait_for_containers() { local found=0 for name in "$@"; do local count=$(echo "$containers" | jq -r "[.nodes[] | select(.label_major == \"$name\")] | length") - if [ "$count" -ge 1 ]; then + if [ -n "$count" ] && [ "$count" -ge 1 ]; then found=$(( found + 1 )) fi done