From 8aa7b37e7eeaad4f0e2b79164e1e3f4fd5dc77d7 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Mon, 5 Oct 2015 11:48:37 +0000 Subject: [PATCH] Add tests for short-lived connection between hosts and containers. --- .../310_container_to_container_edge_test.sh | 18 +++++++++++++ .../320_container_edge_cross_host_2_test.sh | 27 +++++++++++++++++++ integration/setup.sh | 1 + 3 files changed, 46 insertions(+) create mode 100755 integration/310_container_to_container_edge_test.sh create mode 100755 integration/320_container_edge_cross_host_2_test.sh diff --git a/integration/310_container_to_container_edge_test.sh b/integration/310_container_to_container_edge_test.sh new file mode 100755 index 000000000..b1585923e --- /dev/null +++ b/integration/310_container_to_container_edge_test.sh @@ -0,0 +1,18 @@ +#! /bin/bash + +. ./config.sh + +start_suite "Test short lived connections between containers" + +weave_on $HOST1 launch +scope_on $HOST1 launch +weave_on $HOST1 run -d --name nginx nginx +weave_on $HOST1 run -d --name client alpine /bin/sh -c "while true; do wget http://nginx.weave.local:80/ >/dev/null; sleep 1; done" + +sleep 20 # give the probe a few seconds to build a report and send it to the app + +has_container $HOST1 nginx 1 +has_container $HOST1 client 1 +has_connection $HOST1 client nginx + +scope_end_suite diff --git a/integration/320_container_edge_cross_host_2_test.sh b/integration/320_container_edge_cross_host_2_test.sh new file mode 100755 index 000000000..ba98276e1 --- /dev/null +++ b/integration/320_container_edge_cross_host_2_test.sh @@ -0,0 +1,27 @@ +#! /bin/bash + +. ./config.sh + +start_suite "Test short lived connections between containers on different hosts" + +weave_on $HOST1 launch $HOST1 $HOST2 +weave_on $HOST2 launch $HOST1 $HOST2 + +scope_on $HOST1 launch +scope_on $HOST2 launch + +weave_on $HOST1 run -d --name nginx nginx +weave_on $HOST2 run -d --name client alpine /bin/sh -c "while true; do wget http://nginx.weave.local:80/ >/dev/null; sleep 1; done" + +sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports + +check() { + has_container $1 nginx 1 + has_container $1 client 1 + has_connection $1 client nginx +} + +check $HOST1 +check $HOST2 + +scope_end_suite diff --git a/integration/setup.sh b/integration/setup.sh index 53325d4c7..2ef69b345 100755 --- a/integration/setup.sh +++ b/integration/setup.sh @@ -21,6 +21,7 @@ echo Prefetching Images for HOST in $HOSTS; do weave_on $HOST setup docker_on $HOST pull peterbourgon/tns-db + docker_on $HOST pull alpine done curl -sL git.io/weave -o ./weave