port filter integration test for bridge mode

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
Chanwit Kaewkasi 2015-06-05 02:04:28 +07:00
parent 6fcdb572fb
commit 780a936b74
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 ]
}