Add sleeps in tests for topology gossip to propagate
The new weaveworks/mesh version defers topology updates by up to 1 second, so we can't expect to connect two nodes and immediately ping between them.
This commit is contained in:
1 parent
04680fc52c
commit
4da2501d7a
6 files changed
+21
-2
No files matched your search
@@ -26,10 +26,15 @@ start_container $HOST2 $C2/24 --name=c2
|
|||||||
assert_raises "weave_on $HOST2 connect 10.2.2.1 10.2.2.2"
|
assert_raises "weave_on $HOST2 connect 10.2.2.1 10.2.2.2"
|
||||||
assert_peers $HOST2 "10.2.2.1\n10.2.2.2"
|
assert_peers $HOST2 "10.2.2.1\n10.2.2.2"
|
||||||
|
|
||||||
|
sleep 2 # Allow topology to propagate
|
||||||
|
|
||||||
# Replace bogus hosts with real hosts
|
# Replace bogus hosts with real hosts
|
||||||
assert_raises "exec_on $HOST1 c1 sh -c '! $PING $C2'"
|
assert_raises "exec_on $HOST1 c1 sh -c '! $PING $C2'"
|
||||||
assert_raises "weave_on $HOST2 connect --replace $HOST1 $HOST2"
|
assert_raises "weave_on $HOST2 connect --replace $HOST1 $HOST2"
|
||||||
assert_peers $HOST2 "$HOST1\n$HOST2"
|
assert_peers $HOST2 "$HOST1\n$HOST2"
|
||||||
|
|
||||||
|
sleep 2 # Allow topology to propagate
|
||||||
|
|
||||||
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
||||||
|
|
||||||
# Forget everyone and disconnect
|
# Forget everyone and disconnect
|
||||||
@@ -37,6 +42,9 @@ assert_raises "weave_on $HOST2 forget $HOST1 $HOST2"
|
|||||||
assert_raises "stop_weave_on $HOST1"
|
assert_raises "stop_weave_on $HOST1"
|
||||||
assert_raises "weave_on $HOST1 launch"
|
assert_raises "weave_on $HOST1 launch"
|
||||||
assert_peers $HOST2 ""
|
assert_peers $HOST2 ""
|
||||||
|
|
||||||
|
sleep 2 # Allow topology to propagate
|
||||||
|
|
||||||
assert_raises "exec_on $HOST1 c1 sh -c '! $PING $C2'"
|
assert_raises "exec_on $HOST1 c1 sh -c '! $PING $C2'"
|
||||||
|
|
||||||
end_suite
|
end_suite
|
||||||
@@ -9,7 +9,7 @@ kill_weaver() {
|
|||||||
run_on $HOST1 sudo ip link set weave down
|
run_on $HOST1 sudo ip link set weave down
|
||||||
WEAVER_PID=$(container_pid $HOST1 weave)
|
WEAVER_PID=$(container_pid $HOST1 weave)
|
||||||
run_on $HOST1 sudo kill -9 $WEAVER_PID
|
run_on $HOST1 sudo kill -9 $WEAVER_PID
|
||||||
sleep 3
|
sleep 5
|
||||||
}
|
}
|
||||||
|
|
||||||
start_suite "Re-create bridge after restart"
|
start_suite "Re-create bridge after restart"
|
||||||
@@ -20,6 +20,7 @@ WEAVE_NO_FASTDP=1 weave_on $HOST2 launch $HOST1
|
|||||||
|
|
||||||
start_container $HOST1 $C1/24 --name=c1
|
start_container $HOST1 $C1/24 --name=c1
|
||||||
start_container $HOST2 $C2/24 --name=c2
|
start_container $HOST2 $C2/24 --name=c2
|
||||||
|
sleep 2 # give topology gossip some time to propagate
|
||||||
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
||||||
|
|
||||||
kill_weaver # should re-create the bridge
|
kill_weaver # should re-create the bridge
|
||||||
@@ -30,6 +31,7 @@ assert_raises "exec_on $HOST1 c1 $PING $C2"
|
|||||||
weave_on $HOST1 reset
|
weave_on $HOST1 reset
|
||||||
weave_on $HOST1 launch $HOST2
|
weave_on $HOST1 launch $HOST2
|
||||||
weave_on $HOST1 attach $C1/24 c1
|
weave_on $HOST1 attach $C1/24 c1
|
||||||
|
sleep 2 # give topology gossip some time to propagate
|
||||||
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
||||||
|
|
||||||
kill_weaver # should re-create the bridge
|
kill_weaver # should re-create the bridge
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ for host in $HOSTS; do
|
|||||||
weave_on $host launch --ipalloc-range $UNIVERSE $HOSTS
|
weave_on $host launch --ipalloc-range $UNIVERSE $HOSTS
|
||||||
done
|
done
|
||||||
|
|
||||||
|
sleep 2 # Allow topology updates to propagate
|
||||||
|
|
||||||
# Basic test
|
# Basic test
|
||||||
start_container $HOST2 $C2/24 --name=c2 -h $NAME2
|
start_container $HOST2 $C2/24 --name=c2 -h $NAME2
|
||||||
start_container_with_dns $HOST1 $C1/24 --name=c1
|
start_container_with_dns $HOST1 $C1/24 --name=c1
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ weave_on $HOST1 launch --no-discovery
|
|||||||
weave_on $HOST2 launch --no-discovery $HOST1
|
weave_on $HOST2 launch --no-discovery $HOST1
|
||||||
weave_on $HOST3 launch --no-discovery $HOST2
|
weave_on $HOST3 launch --no-discovery $HOST2
|
||||||
|
|
||||||
|
sleep 2 # Allow topology updates to propagate
|
||||||
|
|
||||||
start_container $HOST1 --name=c1
|
start_container $HOST1 --name=c1
|
||||||
C1=$(container_ip $HOST1 c1)
|
C1=$(container_ip $HOST1 c1)
|
||||||
start_container_with_dns $HOST3 --name=c3
|
start_container_with_dns $HOST3 --name=c3
|
||||||
@@ -25,7 +27,7 @@ weave_on $HOST1 launch --no-discovery $HOST3
|
|||||||
# Now re-enable gossip from host2 to host3
|
# Now re-enable gossip from host2 to host3
|
||||||
run_on $HOST3 "sudo iptables -D INPUT -s $HOST2 -j DROP"
|
run_on $HOST3 "sudo iptables -D INPUT -s $HOST2 -j DROP"
|
||||||
|
|
||||||
sleep 1
|
sleep 2 # allow some time for connections to reform and updates to propagate
|
||||||
|
|
||||||
assert_no_dns_record $HOST3 c3 c1.weave.local
|
assert_no_dns_record $HOST3 c3 c1.weave.local
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ assert_raises "timeout 10 cat <( start_container $HOST2 --name c2)"
|
|||||||
# Connect routers
|
# Connect routers
|
||||||
weave_on $HOST2 connect $HOST1
|
weave_on $HOST2 connect $HOST1
|
||||||
|
|
||||||
|
# Allow topology to propagate
|
||||||
|
sleep 2
|
||||||
|
|
||||||
# Check connectivity
|
# Check connectivity
|
||||||
assert_raises "exec_on $HOST1 c1 $PING c2"
|
assert_raises "exec_on $HOST1 c1 $PING c2"
|
||||||
assert_raises "exec_on $HOST2 c2 $PING c1"
|
assert_raises "exec_on $HOST2 c2 $PING c1"
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ weave_on $HOST2 launch $HOST1
|
|||||||
start_container_local_plugin $HOST1 --name=c1 --hostname=$C1_NAME --dns=$DNS_IP
|
start_container_local_plugin $HOST1 --name=c1 --hostname=$C1_NAME --dns=$DNS_IP
|
||||||
start_container_local_plugin $HOST2 --name=c2 --hostname=$C2_NAME --dns=$DNS_IP
|
start_container_local_plugin $HOST2 --name=c2 --hostname=$C2_NAME --dns=$DNS_IP
|
||||||
|
|
||||||
|
sleep 2 # Allow topology to propagate
|
||||||
|
|
||||||
assert_raises "exec_on $HOST1 c1 $PING $C2_NAME"
|
assert_raises "exec_on $HOST1 c1 $PING $C2_NAME"
|
||||||
assert_raises "exec_on $HOST2 c2 $PING $C1_NAME"
|
assert_raises "exec_on $HOST2 c2 $PING $C1_NAME"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user