diff --git a/test/integration/affinities.bats b/test/integration/affinities.bats index 864ad3a8d7..002c7ad2f8 100644 --- a/test/integration/affinities.bats +++ b/test/integration/affinities.bats @@ -28,7 +28,27 @@ function teardown() { run docker_swarm inspect c3 [ "$status" -eq 0 ] - [[ "${output}" == *'"Name": "node-1"'* ]] + [[ "${output}" != *'"Name": "node-0"'* ]] +} + +@test "image affinity" { + start_docker 2 + swarm_manage + + run docker -H ${HOSTS[0]} pull busybox + [ "$status" -eq 0 ] + run docker_swarm run --name c1 -e affinity:image==busybox -d busybox:latest sh + [ "$status" -eq 0 ] + run docker_swarm run --name c2 -e affinity:image!=busybox -d busybox:latest sh + [ "$status" -eq 0 ] + + run docker_swarm inspect c1 + [ "$status" -eq 0 ] + [[ "${output}" == *'"Name": "node-0"'* ]] + + run docker_swarm inspect c2 + [ "$status" -eq 0 ] + [[ "${output}" != *'"Name": "node-0"'* ]] } @test "label affinity" { @@ -52,5 +72,5 @@ function teardown() { run docker_swarm inspect c3 [ "$status" -eq 0 ] - [[ "${output}" == *'"Name": "node-1"'* ]] + [[ "${output}" != *'"Name": "node-0"'* ]] }