Merge pull request #2278 from weaveworks/issues/fix-320-claim-test
Fix 320_claim_3_test.sh
This commit is contained in:
commit
6c7f860418
1 file changed
+25
-8
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
. ./config.sh
|
. ./config.sh
|
||||||
|
|
||||||
UNIVERSE=10.32.0.0/12
|
UNIVERSE=10.2.0.0/16
|
||||||
C1=10.40.0.1
|
C1=10.2.128.1
|
||||||
|
C4=10.2.128.4
|
||||||
|
|
||||||
delete_persistence() {
|
delete_persistence() {
|
||||||
for host in "$@" ; do
|
for host in "$@" ; do
|
||||||
@@ -12,6 +13,20 @@ delete_persistence() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wait_for_container_ip() {
|
||||||
|
host=$1
|
||||||
|
container=$2
|
||||||
|
for i in $(seq 1 120); do
|
||||||
|
echo "Waiting for $container ip at $host"
|
||||||
|
if container_ip $host $container > /dev/null 2>&1 ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "Timed out waiting for $container ip at $host" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
start_suite "Claiming addresses"
|
start_suite "Claiming addresses"
|
||||||
|
|
||||||
weave_on $HOST1 launch-router --ipalloc-range $UNIVERSE $HOST2
|
weave_on $HOST1 launch-router --ipalloc-range $UNIVERSE $HOST2
|
||||||
@@ -55,21 +70,23 @@ stop_weave_on $HOST2
|
|||||||
weave_on $HOST1 launch-router --ipalloc-range $UNIVERSE $HOST3
|
weave_on $HOST1 launch-router --ipalloc-range $UNIVERSE $HOST3
|
||||||
|
|
||||||
stop_weave_on $HOST1
|
stop_weave_on $HOST1
|
||||||
stop_weave_on $HOST2
|
|
||||||
stop_weave_on $HOST3
|
stop_weave_on $HOST3
|
||||||
delete_persistence $HOST1 $HOST2 $HOST3
|
|
||||||
|
|
||||||
|
# Delete persistence data on host1, so that host1 would try to establish a ring.
|
||||||
|
delete_persistence $HOST1
|
||||||
weave_on $HOST1 launch --ipalloc-range $UNIVERSE $HOST2
|
weave_on $HOST1 launch --ipalloc-range $UNIVERSE $HOST2
|
||||||
|
|
||||||
# Start another container on host1. The starting should block, because host1 is
|
# Start another container on host1. The starting should block, because host1 is
|
||||||
# not able to establish the ring due to host2 being offline.
|
# not able to establish the ring due to host2 being offline.
|
||||||
CMD="proxy_start_container $HOST1 --name c4 -e WEAVE_CIDR=10.32.0.4/12"
|
CMD="proxy_start_container $HOST1 --name c4 -e WEAVE_CIDR=$C4/12"
|
||||||
assert_raises "timeout 5 cat <( $CMD )" 124
|
assert_raises "timeout 5 cat <( $CMD )" 124
|
||||||
|
|
||||||
# However, allocation for an external subnet should not block.
|
# However, allocation for an external subnet should not block.
|
||||||
assert_raises "proxy_start_container $HOST1 -e WEAVE_CIDR=10.48.0.1/12"
|
assert_raises "proxy_start_container $HOST1 -e WEAVE_CIDR=10.3.0.1/12"
|
||||||
|
|
||||||
# Launch host2, so that host1 can establish the ring.
|
# Launch host2, so that host1 can establish the ring.
|
||||||
weave_on $HOST2 launch --ipalloc-range $UNIVERSE $HOST1
|
weave_on $HOST2 launch --ipalloc-range $UNIVERSE $HOST1
|
||||||
weave_on $HOST1 prime
|
wait_for_container_ip $HOST1 c4
|
||||||
assert_raises "[ $(container_ip $HOST1 c4) == 10.32.0.4 ]"
|
assert_raises "[ $(container_ip $HOST1 c4) == $C4 ]"
|
||||||
|
|
||||||
end_suite
|
end_suite
|
||||||
Reference in new issue
Block a user