File tree 2 files changed +32
-2
lines changed
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() {
109
109
local from_id=" $3 "
110
110
local to_id=" $4 "
111
111
local timeout=" ${5:- 60} "
112
+ local max_edges=" $6 :10"
112
113
113
114
for i in $( seq " $timeout " ) ; do
114
115
local nodes
115
116
local edge
116
- edge=$( echo " $nodes " | (jq -r " .nodes[\" $from_id \" ].adjacency | contains([\" $to_id \" ])" || true) 2> /dev/null)
117
117
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)
118
119
if [ " $edge " = " true" ]; then
119
120
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 ]"
121
123
return
122
124
fi
123
125
sleep 1
You can’t perform that action at this time.
0 commit comments