Verify rescheduled containers are started properly.

Signed-off-by: Dong Chen <dongluo.chen@docker.com>
This commit is contained in:
Dong Chen 2016-02-08 15:18:09 -08:00
parent 31a3b07b08
commit 30633d10a0
1 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,7 @@ function teardown() {
run docker_swarm inspect c1
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-0"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
run docker_swarm inspect c2
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-0"'* ]]
@ -51,6 +52,7 @@ function teardown() {
run docker_swarm inspect c1
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-1"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
# Check swarm id didn't change for c1
[[ "$swarm_id" == $(docker_swarm inspect -f '{{ index .Config.Labels "com.docker.swarm.id" }}' c1) ]]
@ -93,6 +95,7 @@ function teardown() {
run docker_swarm inspect c1
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-0"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
run docker_swarm inspect c2
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-0"'* ]]
@ -113,6 +116,7 @@ function teardown() {
run docker_swarm inspect c1
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-1"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
# c2 should still be on node-0 since a node constraint was applied.
run docker_swarm inspect c2
@ -155,9 +159,11 @@ function teardown() {
run docker_swarm inspect c1
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-0"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
run docker_swarm inspect c2
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-1"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
# Stop node-0
docker_host stop ${DOCKER_CONTAINERS[0]}
@ -172,11 +178,13 @@ function teardown() {
run docker_swarm inspect c1
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-1"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
# c2 should still be on node-1 since it wasn't affected
run docker_swarm inspect c2
[ "$status" -eq 0 ]
[[ "${output}" == *'"Name": "node-1"'* ]]
[[ "${output}" == *'"Status": "running"'* ]]
# Restart node-0
docker_host start ${DOCKER_CONTAINERS[0]}