From 780a936b742e18e29afaa876b9d1203f1602b76a Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Fri, 5 Jun 2015 02:04:28 +0700 Subject: [PATCH] port filter integration test for bridge mode Signed-off-by: Chanwit Kaewkasi --- .../{port-filter.bats => port-filters.bats} | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) rename test/integration/{port-filter.bats => port-filters.bats} (56%) diff --git a/test/integration/port-filter.bats b/test/integration/port-filters.bats similarity index 56% rename from test/integration/port-filter.bats rename to test/integration/port-filters.bats index 1457fb7215..5997addaee 100644 --- a/test/integration/port-filter.bats +++ b/test/integration/port-filters.bats @@ -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 ] +}