From 46b4fa39ec0002cfe5e3dcb4991808d74dae89e7 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 1 Mar 2016 13:22:50 +0000 Subject: [PATCH] Integration test --- Makefile | 3 ++- integration/410_container_control_test.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8a8ea7a24..39b3da44d 100644 --- a/Makefile +++ b/Makefile @@ -152,4 +152,5 @@ deps: $(GO) get -u -f -tags $(GO_BUILD_TAGS) \ github.com/FiloSottile/gvt \ github.com/mattn/goveralls \ - github.com/weaveworks/github-release + github.com/weaveworks/github-release \ + github.com/2opremio/trifles/wscat diff --git a/integration/410_container_control_test.sh b/integration/410_container_control_test.sh index fa28a33cd..483c18622 100755 --- a/integration/410_container_control_test.sh +++ b/integration/410_container_control_test.sh @@ -14,6 +14,12 @@ wait_for_containers $HOST1 60 alpine assert "docker_on $HOST1 inspect --format='{{.State.Running}}' alpine" "true" PROBEID=$(docker_on $HOST1 logs weavescope 2>&1 | grep "probe starting" | sed -n 's/^.*ID \([0-9a-f]*\)$/\1/p') HOSTID=$(echo $HOST1 | cut -d"." -f1) + + +# Execute 'echo foo' in a container tty and check its output +PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$CID;/docker_exec_container" | jq -r '.pipe' ) +assert "(sleep 1 && echo 'echo foo' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho foo\nfoo\n/ # 6n" + assert_raises "curl -f -X POST 'http://$HOST1:4040/api/control/$PROBEID/$CID;/docker_stop_container'" sleep 5