simplify test
less clever, but more readable
This commit is contained in:
1 parent
c7dd48d769
commit
79d3a2821f
1 file changed
+20
-15
+20
-15
@@ -2,10 +2,10 @@
|
||||
|
||||
. ./config.sh
|
||||
|
||||
C1=c1:10.2.1.34
|
||||
C2=c2:10.2.1.37
|
||||
C3=c3:10.2.2.34
|
||||
C4=c4:10.2.2.37
|
||||
C1=10.2.1.34
|
||||
C2=10.2.1.37
|
||||
C3=10.2.2.34
|
||||
C4=10.2.2.37
|
||||
EXP=10.2.1.101
|
||||
|
||||
PING="ping -nq -W 1 -c 1"
|
||||
@@ -23,37 +23,42 @@ exec_on1() {
|
||||
}
|
||||
|
||||
check_container_connectivity() {
|
||||
exec_on1 "${C1%:*} $PING ${C2#*:}"
|
||||
exec_on1 "${C3%:*} $PING ${C4#*:}"
|
||||
exec_on1 "c1 $PING $C2"
|
||||
exec_on1 "c3 $PING $C4"
|
||||
# fails due to #620
|
||||
# exec_on1 "${C3#:} ! $PING ${C1#*:}"
|
||||
# exec_on1 "c3 ! $PING $C1"
|
||||
}
|
||||
|
||||
start_container() {
|
||||
weave_on $HOST1 run $2/24 --name=$1 -t gliderlabs/alpine /bin/sh
|
||||
}
|
||||
|
||||
start_suite "exposing weave network to host"
|
||||
|
||||
weave_on $HOST1 launch
|
||||
|
||||
for c in $C1 $C2 $C3 $C4; do
|
||||
weave_on $HOST1 run ${c#*:}/24 -t --name=${c%:*} gliderlabs/alpine /bin/sh
|
||||
done
|
||||
start_container c1 $C1
|
||||
start_container c2 $C2
|
||||
start_container c3 $C3
|
||||
start_container c4 $C4
|
||||
|
||||
# absence of host connectivity by default
|
||||
run_on1 "! $PING ${C1#*:}"
|
||||
run_on1 "! $PING $C1"
|
||||
check_container_connectivity
|
||||
|
||||
# host connectivity after 'expose'
|
||||
weave_on1 "expose $EXP/24"
|
||||
run_on1 " $PING ${C1#*:}"
|
||||
run_on1 "! $PING ${C3#*:}"
|
||||
run_on1 " $PING $C1"
|
||||
run_on1 "! $PING $C3"
|
||||
check_container_connectivity
|
||||
|
||||
# idempotence of 'expose'
|
||||
weave_on1 "expose $EXP/24"
|
||||
run_on1 "$PING ${C1#*:}"
|
||||
run_on1 "$PING $C1"
|
||||
|
||||
# no host connectivity after 'hide'
|
||||
weave_on1 "hide $EXP/24"
|
||||
run_on1 "! $PING ${C1#*:}"
|
||||
run_on1 "! $PING $C1"
|
||||
|
||||
# idempotence of 'hide'
|
||||
weave_on1 "hide $EXP/24"
|
||||
|
||||
Reference in new issue
Block a user