diff --git a/test/integration/api.bats b/test/integration/api.bats index 514e75134f..a57262dbf1 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -86,9 +86,41 @@ function teardown() { [[ "${lines[3]}" == *"Nodes: 3" ]] } -# FIXME @test "docker inspect" { - skip + start_docker 3 + swarm_manage + # run container + run docker_swarm run -d --name test_container busybox sleep 500 + [ "$status" -eq 0 ] + + # make sure container exsists + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + + # inspect and verify + run docker_swarm inspect test_container + [ "$status" -eq 0 ] + [[ "${lines[1]}" == *"AppArmorProfile"* ]] +} + +@test "docker inspect --format" { + start_docker 3 + swarm_manage + # run container + run docker_swarm run -d --name test_container busybox sleep 500 + [ "$status" -eq 0 ] + + # make sure container exsists + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + + # inspect --format, return one line: image name + run docker_swarm inspect --format='{{.Config.Image}}' test_container + [ "$status" -eq 0 ] + [ "${#lines[@]}" -eq 1 ] + [[ "${lines[0]}" == "busybox" ]] } # FIXME @@ -121,9 +153,27 @@ function teardown() { skip } -# FIXME @test "docker pause" { - skip + start_docker 3 + swarm_manage + + run docker_swarm run -d --name test_container busybox sleep 1000 + [ "$status" -eq 0 ] + + # make sure container is up + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + [[ "${lines[1]}" == *"Up"* ]] + + run docker_swarm pause test_container + [ "$status" -eq 0 ] + + # verify + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + [[ "${lines[1]}" == *"Paused"* ]] } @test "docker ps -n" { @@ -232,9 +282,36 @@ function teardown() { skip } -# FIXME @test "docker unpause" { - skip + start_docker 3 + swarm_manage + + run docker_swarm run -d --name test_container busybox sleep 1000 + [ "$status" -eq 0 ] + + # make sure container is up + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + [[ "${lines[1]}" == *"Up"* ]] + + # pause + run docker_swarm pause test_container + [ "$status" -eq 0 ] + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + [[ "${lines[1]}" == *"Paused"* ]] + + # unpause + run docker_swarm unpause test_container + [ "$status" -eq 0 ] + # verify + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + [[ "${lines[1]}" == *"Up"* ]] + [[ "${lines[1]}" != *"Paused"* ]] } # FIXME