docs/test/integration/api/stop.bats

31 lines
582 B
Bash

#!/usr/bin/env bats
load ../helpers
function teardown() {
swarm_manage_cleanup
stop_docker
}
@test "docker stop" {
start_docker_with_busybox 2
swarm_manage
# run
docker_swarm run -d --name test_container busybox sleep 500
# make sure container is up before stop
run docker_swarm ps -l
[ "${#lines[@]}" -eq 2 ]
[[ "${lines[1]}" == *"test_container"* ]]
[[ "${lines[1]}" == *"Up"* ]]
# stop
docker_swarm stop test_container
# verify
run docker_swarm ps -l
[ "${#lines[@]}" -eq 2 ]
[[ "${lines[1]}" == *"test_container"* ]]
[[ "${lines[1]}" == *"Exited"* ]]
}