mirror of https://github.com/docker/docs.git
Test reschedule back and forth.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
This commit is contained in:
parent
30633d10a0
commit
cf2d7b12b1
|
|
@ -206,6 +206,7 @@ function start_docker() {
|
|||
docker_host run -d --name node-$i --privileged -v /usr/local/bin -v /var/run -it --net=host \
|
||||
${DOCKER_IMAGE}:${DOCKER_VERSION} \
|
||||
bash -c "\
|
||||
rm /var/run/docker.pid ; \
|
||||
hostname node-$i && \
|
||||
docker daemon -H 127.0.0.1:$port \
|
||||
-H=unix:///var/run/docker.sock \
|
||||
|
|
|
|||
|
|
@ -188,8 +188,27 @@ function teardown() {
|
|||
|
||||
# Restart node-0
|
||||
docker_host start ${DOCKER_CONTAINERS[0]}
|
||||
sleep 6
|
||||
[[ $(docker_swarm info | grep -c "Status: Unhealthy") -eq 0 ]]
|
||||
|
||||
sleep 5
|
||||
run docker_swarm ps
|
||||
[ "${#lines[@]}" -eq 3 ]
|
||||
# Stop node-1
|
||||
docker_host stop ${DOCKER_CONTAINERS[1]}
|
||||
|
||||
# Wait for Swarm to detect the node failure.
|
||||
retry 5 1 eval "docker_swarm info | grep -q 'Unhealthy'"
|
||||
|
||||
# Wait for the container to be rescheduled
|
||||
retry 5 1 eval docker_swarm inspect c1
|
||||
|
||||
# c1 should have been rescheduled from node-1 to node-0
|
||||
run docker_swarm inspect c1
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *'"Name": "node-0"'* ]]
|
||||
[[ "${output}" == *'"Status": "running"'* ]]
|
||||
|
||||
# c2 should have been rescheduled from node-1 to node-0
|
||||
run docker_swarm inspect c2
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *'"Name": "node-0"'* ]]
|
||||
[[ "${output}" == *'"Status": "running"'* ]]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue