From c301e6a38041abda04e524caf07bab3b7557b2ab Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 9 Jun 2015 15:19:31 +0100 Subject: [PATCH] Expand test to use IPAM and check addresses are freed --- test/500_weave_multi_cidr_test.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/500_weave_multi_cidr_test.sh b/test/500_weave_multi_cidr_test.sh index 1e8a63a5..1ea8215c 100755 --- a/test/500_weave_multi_cidr_test.sh +++ b/test/500_weave_multi_cidr_test.sh @@ -11,7 +11,7 @@ assert_container_cidrs() { CIDRS="$@" # Assert container has attached CIDRs - assert_raises "weave_on $HOST ps | grep '^$CID [^ ]* $CIDRS$'" + assert_raises "weave_on $HOST ps $CID | grep '$CIDRS$'" } # assert_zone_records [ ...] @@ -42,36 +42,41 @@ assert_bridge_cidrs() { start_suite "Weave run/start/attach/detach with multiple cidr arguments" -weave_on $HOST1 launch +weave_on $HOST1 launch -debug -iprange 10.2.3.0/24 weave_on $HOST1 launch-dns 10.254.254.254/24 # Run container with three cidrs -CID=$(start_container $HOST1 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 --name=multicidr -h $NAME | cut -b 1-12) +CID=$(start_container $HOST1 10.2.1.1/24 10.2.2.1/24 --subnet 10.2.3.0/24 --name=multicidr -h $NAME | cut -b 1-12) assert_container_cidrs $HOST1 $CID 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 assert_zone_records $HOST1 $CID $NAME. 10.2.1.1 10.2.2.1 10.2.3.1 # Remove two of them -weave_on $HOST1 detach 10.2.1.1/24 10.2.3.1/24 $CID +weave_on $HOST1 detach 10.2.1.1/24 --subnet 10.2.3.0/24 $CID assert_container_cidrs $HOST1 $CID 10.2.2.1/24 assert_zone_records $HOST1 $CID $NAME. 10.2.2.1 # Put them both back -weave_on $HOST1 attach 10.2.1.1/24 10.2.3.1/24 $CID +weave_on $HOST1 attach 10.2.1.1/24 --subnet 10.2.3.0/24 $CID assert_container_cidrs $HOST1 $CID 10.2.2.1/24 10.2.1.1/24 10.2.3.1/24 assert_zone_records $HOST1 $CID $NAME. 10.2.2.1 10.2.1.1 10.2.3.1 # Stop the container, restart with three IPs docker_on $HOST1 stop $CID -weave_on $HOST1 start 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 $CID +weave_on $HOST1 start 10.2.1.1/24 10.2.2.1/24 --subnet 10.2.3.0/24 $CID assert_container_cidrs $HOST1 $CID 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 assert_zone_records $HOST1 $CID $NAME. 10.2.1.1 10.2.2.1 10.2.3.1 # Expose some cidrs -weave_on $HOST1 expose 10.2.1.2/24 10.2.2.2/24 10.2.3.2/24 +weave_on $HOST1 expose 10.2.1.2/24 10.2.2.2/24 --subnet 10.2.3.0/24 assert_bridge_cidrs $HOST1 weave 10.2.1.2/24 10.2.2.2/24 10.2.3.2/24 # Hide some cidrs -weave_on $HOST1 hide 10.2.1.2/24 10.2.3.2/24 +weave_on $HOST1 hide 10.2.1.2/24 --subnet 10.2.3.0/24 assert_bridge_cidrs $HOST1 weave 10.2.2.2/24 +# Now detach and run another container to check we have released IPs in IPAM +weave_on $HOST1 detach --subnet 10.2.3.0/24 $CID +CID2=$(start_container $HOST1 --subnet 10.2.3.0/24) +assert_container_cidrs $HOST1 $CID2 10.2.3.1/24 + end_suite