Merge pull request #900 from chanwit/test-bridge-mode

port filter integration test for bridge mode
This commit is contained in:
Victor Vieux 2015-06-04 14:56:46 -07:00
commit b661323bc3
1 changed files with 20 additions and 1 deletions

View File

@ -7,7 +7,7 @@ function teardown() {
stop_docker
}
@test "docker should filter port in host mode correctly" {
@test "port filter: host mode" {
start_docker_with_busybox 2
swarm_manage
@ -27,3 +27,22 @@ function teardown() {
run docker_swarm ps -n 2
[ "${#lines[@]}" -eq 3 ]
}
@test "port filter: bridge mode" {
start_docker_with_busybox 2
swarm_manage
run docker_swarm run -d --expose=80 -p 80:80 busybox sh
[ "$status" -eq 0 ]
run docker_swarm run -d --expose=80 -p 80:80 busybox sh
[ "$status" -eq 0 ]
# When trying to start the 3rd one, it should be error finding port 80.
run docker_swarm run -d --expose=80 -p 80:80 busybox sh
[ "$status" -ne 0 ]
[[ "${lines[0]}" == *"unable to find a node with port 80 available"* ]]
# And the number of running containers should be still 2.
run docker_swarm ps -n 2
[ "${#lines[@]}" -eq 3 ]
}