Expand test to use IPAM and check addresses are freed
This commit is contained in:
1 parent
a3d73be8b8
commit
c301e6a380
1 file changed
+13
-8
@@ -11,7 +11,7 @@ assert_container_cidrs() {
|
|||||||
CIDRS="$@"
|
CIDRS="$@"
|
||||||
|
|
||||||
# Assert container has attached 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 <host> <cid> <fqdn> <ip> [<ip> ...]
|
# assert_zone_records <host> <cid> <fqdn> <ip> [<ip> ...]
|
||||||
@@ -42,36 +42,41 @@ assert_bridge_cidrs() {
|
|||||||
|
|
||||||
start_suite "Weave run/start/attach/detach with multiple cidr arguments"
|
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
|
weave_on $HOST1 launch-dns 10.254.254.254/24
|
||||||
|
|
||||||
# Run container with three cidrs
|
# 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_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
|
assert_zone_records $HOST1 $CID $NAME. 10.2.1.1 10.2.2.1 10.2.3.1
|
||||||
|
|
||||||
# Remove two of them
|
# 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_container_cidrs $HOST1 $CID 10.2.2.1/24
|
||||||
assert_zone_records $HOST1 $CID $NAME. 10.2.2.1
|
assert_zone_records $HOST1 $CID $NAME. 10.2.2.1
|
||||||
|
|
||||||
# Put them both back
|
# 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_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
|
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
|
# Stop the container, restart with three IPs
|
||||||
docker_on $HOST1 stop $CID
|
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_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
|
assert_zone_records $HOST1 $CID $NAME. 10.2.1.1 10.2.2.1 10.2.3.1
|
||||||
|
|
||||||
# Expose some cidrs
|
# 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
|
assert_bridge_cidrs $HOST1 weave 10.2.1.2/24 10.2.2.2/24 10.2.3.2/24
|
||||||
|
|
||||||
# Hide some cidrs
|
# 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
|
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
|
end_suite
|
||||||
Reference in new issue
Block a user