Merge pull request #636 from jimmyxian/add-attach-websocket-integration-test

Add attach-ws api integration test
This commit is contained in:
Andrea Luzzardi 2015-04-21 14:06:36 -07:00
commit 7c4f866926
1 changed files with 20 additions and 0 deletions

View File

@ -26,6 +26,26 @@ function teardown() {
[ "$status" -eq 0 ]
}
@test "docker attach through websocket" {
CLIENT_API_VERSION="v1.17"
start_docker 2
swarm_manage
#create a container
run docker_swarm run -d --name test_container busybox sleep 1000
# 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
URL="ws://${SWARM_HOST}/${CLIENT_API_VERSION}/containers/test_container/attach/ws?stderr=1"
run docker run --rm --net=host jimmyxian/centos7-wssh wssh $URL
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 2 ]
[[ "${lines[0]}" == *"Session Open"* ]]
[[ "${lines[1]}" == *"Session Closed"* ]]
}
@test "docker build" {
start_docker 3
swarm_manage