added image affinity test and !=

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2015-04-27 10:05:38 -07:00
parent 77f0ac919a
commit a2dc4b87c5
1 changed files with 22 additions and 2 deletions

View File

@ -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"'* ]]
}