Files
docker-docs/test/integration/api/exec.bats
Andrea Luzzardi 4bb035e41a integration: Fix API races related to delay in refresh.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-08 19:26:58 -07:00

31 lines
793 B
Bash

#!/usr/bin/env bats
load ../helpers
function teardown() {
swarm_manage_cleanup
stop_docker
}
@test "docker exec" {
start_docker_with_busybox 2
swarm_manage
docker_swarm create --name test_container busybox sleep 100
# if container is not runing, exec will failed
run docker_swarm exec test_container ls
[ "$status" -ne 0 ]
[[ "$output" == *"is not running"* ]]
docker_swarm start test_container
# make sure container is up and not paused
# FIXME(#748): Retry required because of race condition.
retry 5 0.5 eval "[ $(docker_swarm inspect -f '{{ .State.Running }}' test_container) == 'true' ]"
[ $(docker_swarm inspect -f '{{ .State.Paused }}' test_container) == 'false' ]
run docker_swarm exec test_container echo foobar
[ "$status" -eq 0 ]
[ "$output" == "foobar" ]
}