From 2fa65f0a22b6cf77cf9b2650819902c618fc8c35 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 16 Jul 2015 12:44:09 +0100 Subject: [PATCH] Smoke-test for claim operation --- test/160_claim_test.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 test/160_claim_test.sh diff --git a/test/160_claim_test.sh b/test/160_claim_test.sh new file mode 100755 index 00000000..b0b6ece2 --- /dev/null +++ b/test/160_claim_test.sh @@ -0,0 +1,30 @@ +#! /bin/bash + +. ./config.sh + +start_suite "Claiming addresses" + +weave_on $HOST1 launch-router +weave_on $HOST2 launch-router $HOST1 + +start_container $HOST1 --name=c1 +start_container $HOST2 --name=c2 +C1=$(container_ip $HOST1 c1) +assert_raises "exec_on $HOST2 c2 $PING $C1" + +stop_router_on $HOST1 +stop_router_on $HOST2 + +# Start hosts in reverse order so c1's address has to be claimed from host2 +weave_on $HOST2 launch-router +weave_on $HOST1 launch-router $HOST2 + +# Start another container on host2, so if it hasn't relinquished c1's +# address it would give that out as the first available. +start_container $HOST2 --name=c3 +C3=$(container_ip $HOST2 c3) +assert_raises "[ $C3 != $C1 ]" + +assert_raises "exec_on $HOST1 c1 $PING $C3" + +end_suite