File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed
Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # shellcheck disable=SC1091
4+ . ./config.sh
5+
6+ start_suite " Test short lived connections between containers on different hosts"
7+
8+ weave_on " $HOST1 " launch " $HOST1 " " $HOST2 "
9+ weave_on " $HOST2 " launch " $HOST1 " " $HOST2 "
10+
11+ scope_on " $HOST1 " launch
12+ scope_on " $HOST2 " launch
13+
14+ server_on " $HOST1 "
15+ client_on " $HOST2 "
16+
17+ sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports
18+
19+ check () {
20+ has_container " $1 " nginx
21+ has_container " $1 " client
22+ has_connection containers " $1 " client nginx
23+ }
24+
25+ check " $HOST1 "
26+ check " $HOST2 "
27+
28+ scope_end_suite
Original file line number Diff line number Diff line change @@ -109,15 +109,17 @@ has_connection_by_id() {
109109 local from_id=" $3 "
110110 local to_id=" $4 "
111111 local timeout=" ${5:- 60} "
112+ local max_edges=" $6 :10"
112113
113114 for i in $( seq " $timeout " ) ; do
114115 local nodes
115116 local edge
116- edge=$( echo " $nodes " | (jq -r " .nodes[\" $from_id \" ].adjacency | contains([\" $to_id \" ])" || true) 2> /dev/null)
117117 nodes=$( curl -s " http://$host :4040/api/topology/${view} ?system=show" || true)
118+ edge=$( echo " $nodes " | (jq -r " .nodes[\" $from_id \" ].adjacency | contains([\" $to_id \" ])" || true) 2> /dev/null)
118119 if [ " $edge " = " true" ]; then
119120 echo " Found edge $from -> $to after $i secs"
120- assert " curl -s http://$host :4040/api/topology/${view} ?system=show | jq -r '.nodes[\" $from_id \" ].adjacency | contains([\" $to_id \" ])'" true
121+ count=$( echo " $nodes " | jq -r " .nodes[\" $from_id \" ].adjacency | length" 2> /dev/null)
122+ assert " [ $count -le $max_edges ]"
121123 return
122124 fi
123125 sleep 1
You can’t perform that action at this time.
0 commit comments