From 2e874d3148bb2f028f34d47d51d705e9452103aa Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Tue, 5 May 2015 08:03:17 -0400 Subject: [PATCH 1/4] fix issue: #701 Signed-off-by: Xian Chaobo --- test/integration/api.bats | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index e4d63bfc45..a9fca844d5 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -43,9 +43,6 @@ function teardown() { } @test "docker attach through websocket" { - #FIXME: Broken - skip - CLIENT_API_VERSION="v1.17" start_docker 2 swarm_manage @@ -57,6 +54,8 @@ function teardown() { # jimmyxian/centos7-wssh is an image with websocket CLI(WSSH) wirtten in Nodejs # if connected successfull, it returns two lines, "Session Open" and "Session Closed" # Note: with stdout=1&stdin=1&stream=1: it can be used as SSH + docker pull jimmyxian/centos7-wssh + URL="ws://${SWARM_HOST}/${CLIENT_API_VERSION}/containers/test_container/attach/ws?stderr=1" run docker_host run --rm --net=host jimmyxian/centos7-wssh wssh $URL [ "$status" -eq 0 ] From f6254241df97e810b7782b153ab2f08b89e17cd6 Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Tue, 5 May 2015 21:09:25 -0400 Subject: [PATCH 2/4] using docker_host instead of docker Signed-off-by: Xian Chaobo --- test/integration/api.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index a9fca844d5..b0d9b0a079 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -54,7 +54,7 @@ function teardown() { # jimmyxian/centos7-wssh is an image with websocket CLI(WSSH) wirtten in Nodejs # if connected successfull, it returns two lines, "Session Open" and "Session Closed" # Note: with stdout=1&stdin=1&stream=1: it can be used as SSH - docker pull jimmyxian/centos7-wssh + docker_host pull jimmyxian/centos7-wssh URL="ws://${SWARM_HOST}/${CLIENT_API_VERSION}/containers/test_container/attach/ws?stderr=1" run docker_host run --rm --net=host jimmyxian/centos7-wssh wssh $URL From b5756d601830f5043503182be1fdca41b402e2b4 Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Tue, 5 May 2015 22:40:14 -0400 Subject: [PATCH 3/4] check pull status Signed-off-by: Xian Chaobo --- test/integration/api.bats | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/api.bats b/test/integration/api.bats index b0d9b0a079..a6a233a520 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -49,12 +49,14 @@ function teardown() { #create a container run docker_swarm run -d --name test_container busybox sleep 1000 + [ "$status" -eq 0 ] # test attach-ws api # jimmyxian/centos7-wssh is an image with websocket CLI(WSSH) wirtten in Nodejs # if connected successfull, it returns two lines, "Session Open" and "Session Closed" # Note: with stdout=1&stdin=1&stream=1: it can be used as SSH docker_host pull jimmyxian/centos7-wssh + [ "$status" -eq 0 ] URL="ws://${SWARM_HOST}/${CLIENT_API_VERSION}/containers/test_container/attach/ws?stderr=1" run docker_host run --rm --net=host jimmyxian/centos7-wssh wssh $URL From b0b2290e2561bd37cd322de6b3d9740b449f583b Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Tue, 5 May 2015 23:13:58 -0400 Subject: [PATCH 4/4] using output instead of lines Signed-off-by: Xian Chaobo --- test/integration/api.bats | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index a6a233a520..8146e8a2fc 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -55,15 +55,11 @@ function teardown() { # jimmyxian/centos7-wssh is an image with websocket CLI(WSSH) wirtten in Nodejs # if connected successfull, it returns two lines, "Session Open" and "Session Closed" # Note: with stdout=1&stdin=1&stream=1: it can be used as SSH - docker_host pull jimmyxian/centos7-wssh - [ "$status" -eq 0 ] - URL="ws://${SWARM_HOST}/${CLIENT_API_VERSION}/containers/test_container/attach/ws?stderr=1" run docker_host run --rm --net=host jimmyxian/centos7-wssh wssh $URL [ "$status" -eq 0 ] - [ "${#lines[@]}" -eq 2 ] - [[ "${lines[0]}" == *"Session Open"* ]] - [[ "${lines[1]}" == *"Session Closed"* ]] + [[ "${output}" == *"Session Open"* ]] + [[ "${output}" == *"Session Closed"* ]] } @test "docker build" {