From 35ff088604814429ab438f01ba2e6f6d847923e9 Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Wed, 22 Apr 2015 08:59:12 +0800 Subject: [PATCH] add commit exec integration test Signed-off-by: Xian Chaobo --- test/integration/api.bats | 46 +++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index 514e75134f..12a067563e 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -28,9 +28,31 @@ function teardown() { [ "${#lines[@]}" -eq 1 ] } -# FIXME @test "docker commit" { - skip + start_docker 3 + swarm_manage + + run docker_swarm run -d --name test_container busybox sleep 500 + [ "$status" -eq 0 ] + + # make sure container exists + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + + # no comming name before commit + run docker_swarm images + [ "$status" -eq 0 ] + [[ "${output}" != *"commit_image_busybox"* ]] + + # commit container + run docker_swarm commit test_container commit_image_busybox + [ "$status" -eq 0 ] + + # verify after commit + run docker_swarm images + [ "$status" -eq 0 ] + [[ "${output}" == *"commit_image_busybox"* ]] } # FIXME @@ -53,9 +75,25 @@ function teardown() { skip } -# FIXME @test "docker exec" { - skip + start_docker 3 + swarm_manage + run docker_swarm run -d --name test_container busybox sleep 100 + [ "$status" -eq 0 ] + + # make sure container is up and not paused + run docker_swarm ps -l + [ "${#lines[@]}" -eq 2 ] + [[ "${lines[1]}" == *"test_container"* ]] + [[ "${lines[1]}" == *"Up"* ]] + [[ "${lines[1]}" != *"Paused"* ]] + + # FIXME: if issue #658 solved, use 'exec' instead of 'exec -i' + run docker_swarm exec -i test_container ls + [ "$status" -eq 0 ] + [ "${#lines[@]}" -ge 2 ] + [[ "${lines[0]}" == *"bin"* ]] + [[ "${lines[1]}" == *"dev"* ]] } # FIXME