From 97aad7e60cfe6fe30b25e374851c3da1fcfe62c9 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Mon, 4 May 2015 15:18:03 -0700 Subject: [PATCH] fix attach integration test Signed-off-by: Andrea Luzzardi --- test/integration/api.bats | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index cc5cf55066..42edbf4d46 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -12,18 +12,17 @@ function teardown() { swarm_manage # container run in background - run docker_swarm run -d --name test_container busybox sleep 100 + run docker_swarm run -d -i --name test_container busybox sh -c "head -n 1; echo output" [ "$status" -eq 0 ] - # make sure container is up - run docker_swarm ps -l - [ "${#lines[@]}" -eq 2 ] - [[ "${lines[1]}" == *"test_container"* ]] - [[ "${lines[1]}" == *"Up"* ]] - - # attach to running container - run docker_swarm attach test_container + # inject input into the container + attach_output=`echo input | docker_swarm attach test_container` + # unfortunately, we cannot test `attach_output` because attach is not + # properly returning the output (see docker/docker#12974) + run docker_swarm logs test_container [ "$status" -eq 0 ] + [[ "${output}" == *"input"* ]] + [[ "${output}" == *"output"* ]] } @test "docker attach through websocket" {