Fix tests where newer Docker returns hex ID of container as network ID

This commit is contained in:
Bryan Boreham committed 2020-07-31 16:29:41 +00:00
1 parent aa9caab1b0
commit c50b3380ea
1 file changed
+6 -6
+6 -6
View File
@@ -6,7 +6,7 @@ start_suite "Abuse of 'start' operation"
weave_on $HOST1 launch
docker_bridge_ip=$(weave_on $HOST1 docker-bridge-ip)
proxy_start_container $HOST1 --name=c1
id1=$(proxy_start_container $HOST1 --name=c1)
check_hostconfig() {
docker_on $HOST1 attach $1 >/dev/null 2>&1 || true # Wait for container to exit
@@ -16,12 +16,12 @@ check_hostconfig() {
# Start c2 with a sneaky HostConfig
proxy docker_on $HOST1 create --name=c2 $SMALL_IMAGE $CHECK_ETHWE_UP
proxy docker_api_on $HOST1 POST /containers/c2/start '{"NetworkMode": "container:c1"}'
check_hostconfig c2 container:c1
check_hostconfig c2 "container:$id1"
# Start c5 with a differently sneaky HostConfig
proxy docker_on $HOST1 create --name=c5 $SMALL_IMAGE $CHECK_ETHWE_UP
proxy docker_api_on $HOST1 POST /containers/c5/start '{"HostConfig": {"NetworkMode": "container:c1"}}'
check_hostconfig c5 container:c1
check_hostconfig c5 "container:$id1"
# Start c3 with HostConfig having empty binds and null dns/networking settings
proxy docker_on $HOST1 create --name=c3 -v /tmp:/hosttmp $SMALL_IMAGE $CHECK_ETHWE_UP
@@ -41,7 +41,7 @@ assert "docker_on $HOST1 inspect -f '{{.HostConfig.MemorySwap}}' c4b" "-1"
# Start c6 with both named and unnamed HostConfig
proxy docker_on $HOST1 create --name=c6 $SMALL_IMAGE $CHECK_ETHWE_UP
proxy docker_api_on $HOST1 POST /containers/c6/start '{"NetworkMode": "container:c2", "HostConfig": {"NetworkMode": "container:c1"}}'
check_hostconfig c6 container:c1
check_hostconfig c6 "container:$id1"
# Start c7 with an empty HostConfig and check this removes previous parameters, but still attaches to weave
proxy docker_on $HOST1 create --name=c7 --memory-swap -1 $SMALL_IMAGE $CHECK_ETHWE_UP
@@ -55,9 +55,9 @@ proxy docker_api_on $HOST1 POST /containers/c8/start '{"HostConfig": {"NetworkMo
check_hostconfig c8 host
# Start c10 in network of host container
proxy_start_container $HOST1 --name=c9 --net=host
id9=$(proxy_start_container $HOST1 --name=c9 --net=host)
proxy docker_on $HOST1 create --name=c10 $SMALL_IMAGE $CHECK_ETHWE_MISSING
proxy docker_api_on $HOST1 POST /containers/c10/start '{"HostConfig": {"NetworkMode": "container:c9"}}'
check_hostconfig c10 container:c9
check_hostconfig c10 "container:$id9"
end_suite