mirror of https://github.com/docker/docs.git
port filter integration test for bridge mode
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
parent
6fcdb572fb
commit
780a936b74
|
|
@ -7,7 +7,7 @@ function teardown() {
|
||||||
stop_docker
|
stop_docker
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "docker should filter port in host mode correctly" {
|
@test "port filter: host mode" {
|
||||||
start_docker_with_busybox 2
|
start_docker_with_busybox 2
|
||||||
swarm_manage
|
swarm_manage
|
||||||
|
|
||||||
|
|
@ -27,3 +27,22 @@ function teardown() {
|
||||||
run docker_swarm ps -n 2
|
run docker_swarm ps -n 2
|
||||||
[ "${#lines[@]}" -eq 3 ]
|
[ "${#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 ]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue