mirror of
https://github.com/docker/docs.git
synced 2026-04-04 18:28:58 +07:00
33 lines
619 B
Bash
33 lines
619 B
Bash
#!/usr/bin/env bats
|
|
|
|
load ../helpers
|
|
|
|
function teardown() {
|
|
swarm_manage_cleanup
|
|
stop_docker
|
|
}
|
|
|
|
@test "docker stop" {
|
|
start_docker 3
|
|
swarm_manage
|
|
# run
|
|
run docker_swarm run -d --name test_container busybox sleep 500
|
|
[ "$status" -eq 0 ]
|
|
|
|
# make sure container is up before stop
|
|
run docker_swarm ps -l
|
|
[ "${#lines[@]}" -eq 2 ]
|
|
[[ "${lines[1]}" == *"test_container"* ]]
|
|
[[ "${lines[1]}" == *"Up"* ]]
|
|
|
|
# stop
|
|
run docker_swarm stop test_container
|
|
[ "$status" -eq 0 ]
|
|
|
|
# verify
|
|
run docker_swarm ps -l
|
|
[ "${#lines[@]}" -eq 2 ]
|
|
[[ "${lines[1]}" == *"test_container"* ]]
|
|
[[ "${lines[1]}" == *"Exited"* ]]
|
|
}
|