From 6ef8281ad03681dbe5bf84413451657f018721ca Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sun, 25 Jun 2017 06:46:17 +0100 Subject: [PATCH 1/3] replace `weave run` with use of weave proxy since Weave Net 2.0 removed `weave run`. --- integration/310_container_to_container_edge_test.sh | 4 ++-- .../311_container_to_container_edge_without_ebpf_test.sh | 4 ++-- ...ainer_to_container_edge_with_ebpf_proc_fallback_test.sh | 4 ++-- integration/314_container_accept_before_kretprobe_test.sh | 4 ++-- integration/320_container_edge_cross_host_2_test.sh | 4 ++-- integration/330_process_edge_test.sh | 4 ++-- integration/340_process_edge_across_host_2_test.sh | 4 ++-- integration/410_container_control_test.sh | 2 +- integration/config.sh | 7 +++++++ 9 files changed, 22 insertions(+), 15 deletions(-) diff --git a/integration/310_container_to_container_edge_test.sh b/integration/310_container_to_container_edge_test.sh index e40d86f4c0..307d4e5163 100755 --- a/integration/310_container_to_container_edge_test.sh +++ b/integration/310_container_to_container_edge_test.sh @@ -7,8 +7,8 @@ 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 \ +weave_proxy_on "$HOST1" run -d --name nginx nginx +weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ sleep 1; \ done" diff --git a/integration/311_container_to_container_edge_without_ebpf_test.sh b/integration/311_container_to_container_edge_without_ebpf_test.sh index c3190ad5a6..84b95f7255 100755 --- a/integration/311_container_to_container_edge_without_ebpf_test.sh +++ b/integration/311_container_to_container_edge_without_ebpf_test.sh @@ -7,8 +7,8 @@ start_suite "Test short lived connections between containers, without ebpf conne weave_on "$HOST1" launch scope_on "$HOST1" launch --probe.ebpf.connections=false -weave_on "$HOST1" run -d --name nginx nginx -weave_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ +weave_proxy_on "$HOST1" run -d --name nginx nginx +weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ sleep 1; \ done" diff --git a/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh b/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh index 7aee7d2d37..44e9e6b126 100755 --- a/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh +++ b/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh @@ -12,8 +12,8 @@ weave_on "$HOST1" launch DOCKER_HOST=tcp://${HOST1}:${DOCKER_PORT} CHECKPOINT_DISABLE=true \ WEAVESCOPE_DOCKER_ARGS="-v /tmp:/sys/kernel/debug/tracing:ro" \ "${SCOPE}" launch -weave_on "$HOST1" run -d --name nginx nginx -weave_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ +weave_proxy_on "$HOST1" run -d --name nginx nginx +weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ sleep 1; \ done" diff --git a/integration/314_container_accept_before_kretprobe_test.sh b/integration/314_container_accept_before_kretprobe_test.sh index a34582ca5d..cc04d0b46e 100755 --- a/integration/314_container_accept_before_kretprobe_test.sh +++ b/integration/314_container_accept_before_kretprobe_test.sh @@ -10,7 +10,7 @@ weave_on "$HOST1" launch # Launch the server before Scope to make sure it calls accept() before Scope's # kretprobe on the accept function is installed. We use busybox' nc instead of # Alpine's nc so that it blocks on the accept() syscall. -weave_on "$HOST1" run -d --name server busybox /bin/sh -c "while true; do \ +weave_proxy_on "$HOST1" run -d --name server busybox /bin/sh -c "while true; do \ date ; sleep 1 ; done | nc -l -p 8080" @@ -19,7 +19,7 @@ scope_on "$HOST1" launch wait_for_containers "$HOST1" 60 server has_container "$HOST1" server -weave_on "$HOST1" run -d --name client busybox /bin/sh -c "ping -c 5 server.weave.local; \ +weave_proxy_on "$HOST1" run -d --name client busybox /bin/sh -c "ping -c 5 server.weave.local; \ while true; do \ date ; sleep 1 ; diff --git a/integration/320_container_edge_cross_host_2_test.sh b/integration/320_container_edge_cross_host_2_test.sh index 5a0d3b19c2..7e63b95e06 100755 --- a/integration/320_container_edge_cross_host_2_test.sh +++ b/integration/320_container_edge_cross_host_2_test.sh @@ -11,8 +11,8 @@ 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 \ +weave_proxy_on "$HOST1" run -d --name nginx nginx +weave_proxy_on "$HOST2" run -d --name client alpine /bin/sh -c "while true; do \ wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ sleep 1; \ done" diff --git a/integration/330_process_edge_test.sh b/integration/330_process_edge_test.sh index e986d13cef..414e564934 100755 --- a/integration/330_process_edge_test.sh +++ b/integration/330_process_edge_test.sh @@ -7,8 +7,8 @@ start_suite "Test long connections (procspy) between processes" weave_on "$HOST1" launch scope_on "$HOST1" launch --probe.conntrack=false -weave_on "$HOST1" run -d --name nginx nginx -weave_on "$HOST1" run -dti --name client alpine /bin/sh -c "while true; do \ +weave_proxy_on "$HOST1" run -d --name nginx nginx +weave_proxy_on "$HOST1" run -dti --name client alpine /bin/sh -c "while true; do \ nc nginx.weave.local 80 || true; \ sleep 1; \ done" diff --git a/integration/340_process_edge_across_host_2_test.sh b/integration/340_process_edge_across_host_2_test.sh index 9947e7fbf2..0ead397f89 100755 --- a/integration/340_process_edge_across_host_2_test.sh +++ b/integration/340_process_edge_across_host_2_test.sh @@ -11,8 +11,8 @@ weave_on "$HOST2" launch "$HOST1" "$HOST2" scope_on "$HOST1" launch --probe.conntrack=false scope_on "$HOST2" launch --probe.conntrack=false -weave_on "$HOST1" run -d --name nginx nginx -weave_on "$HOST2" run -dti --name client alpine /bin/sh -c "while true; do \ +weave_proxy_on "$HOST1" run -d --name nginx nginx +weave_proxy_on "$HOST2" run -dti --name client alpine /bin/sh -c "while true; do \ nc nginx.weave.local 80 || true; \ sleep 1; \ done" diff --git a/integration/410_container_control_test.sh b/integration/410_container_control_test.sh index 02f731f149..5c2f50289e 100755 --- a/integration/410_container_control_test.sh +++ b/integration/410_container_control_test.sh @@ -8,7 +8,7 @@ start_suite "Test container controls" weave_on "$HOST1" launch scope_on "$HOST1" launch -CID=$(weave_on "$HOST1" run -dti --name alpine alpine /bin/sh) +CID=$(weave_proxy_on "$HOST1" run -dti --name alpine alpine /bin/sh) wait_for_containers "$HOST1" 60 alpine diff --git a/integration/config.sh b/integration/config.sh index ac7d37c21c..a69a265386 100644 --- a/integration/config.sh +++ b/integration/config.sh @@ -28,6 +28,13 @@ weave_on() { DOCKER_HOST=tcp://$host:$DOCKER_PORT CHECKPOINT_DISABLE=true "$WEAVE" "$@" } +weave_proxy_on() { + local host=$1 + shift 1 + [ -z "$DEBUG" ] || greyly echo "Weave proxy on $host: $*" >&2 + DOCKER_PORT=12375 docker_on "$host" "$@" +} + scope_end_suite() { end_suite for host in $HOSTS; do From 30168c520e1c38919cae925324629f99f2e5ba2a Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sun, 25 Jun 2017 07:14:20 +0100 Subject: [PATCH 2/3] don't look for 'weaveproxy' - it no longer exists ... as of Weave Net 2.0 --- integration/100_launch_test.sh | 3 +-- integration/105_launch_sans_weave_test.sh | 1 - integration/200_clustering_2_test.sh | 1 - integration/205_clustering_sans_weave_2_test.sh | 1 - integration/210_clustering_custom_hostname_2_test.sh | 1 - 5 files changed, 1 insertion(+), 6 deletions(-) diff --git a/integration/100_launch_test.sh b/integration/100_launch_test.sh index 45dba69fa0..8dbc1c22a6 100755 --- a/integration/100_launch_test.sh +++ b/integration/100_launch_test.sh @@ -8,10 +8,9 @@ start_suite "Launch scope and check it boots" weave_on "$HOST1" launch scope_on "$HOST1" launch -wait_for_containers "$HOST1" 60 weave weaveproxy weavescope +wait_for_containers "$HOST1" 60 weave weavescope has_container "$HOST1" weave -has_container "$HOST1" weaveproxy has_container "$HOST1" weavescope scope_end_suite diff --git a/integration/105_launch_sans_weave_test.sh b/integration/105_launch_sans_weave_test.sh index ac27d5aa73..541a95ed9d 100755 --- a/integration/105_launch_sans_weave_test.sh +++ b/integration/105_launch_sans_weave_test.sh @@ -10,7 +10,6 @@ scope_on "$HOST1" launch wait_for_containers "$HOST1" 60 weavescope has_container "$HOST1" weave 0 -has_container "$HOST1" weaveproxy 0 has_container "$HOST1" weavescope scope_end_suite diff --git a/integration/200_clustering_2_test.sh b/integration/200_clustering_2_test.sh index 07c6a6cf8e..62c6f0df07 100755 --- a/integration/200_clustering_2_test.sh +++ b/integration/200_clustering_2_test.sh @@ -18,7 +18,6 @@ sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and check() { has_container "$1" weave 2 - has_container "$1" weaveproxy 2 has_container "$1" weavescope 2 has_container "$1" db1 has_container "$1" db2 diff --git a/integration/205_clustering_sans_weave_2_test.sh b/integration/205_clustering_sans_weave_2_test.sh index ad6a95c91f..7e68347d3f 100755 --- a/integration/205_clustering_sans_weave_2_test.sh +++ b/integration/205_clustering_sans_weave_2_test.sh @@ -15,7 +15,6 @@ sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and check() { has_container "$1" weave 0 - has_container "$1" weaveproxy 0 has_container "$1" weavescope 2 has_container "$1" db1 has_container "$1" db2 diff --git a/integration/210_clustering_custom_hostname_2_test.sh b/integration/210_clustering_custom_hostname_2_test.sh index 043487659b..4de33483eb 100755 --- a/integration/210_clustering_custom_hostname_2_test.sh +++ b/integration/210_clustering_custom_hostname_2_test.sh @@ -18,7 +18,6 @@ sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and check() { has_container "$1" weave 2 - has_container "$1" weaveproxy 2 has_container "$1" weavescope 2 has_container "$1" db1 has_container "$1" db2 From b2f14a96c586aa96a8c5f6018f6c7d50af54b9ee Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sun, 25 Jun 2017 08:30:28 +0100 Subject: [PATCH 3/3] refactor: extract a couple of test helpers --- integration/310_container_to_container_edge_test.sh | 8 +++----- ...1_container_to_container_edge_without_ebpf_test.sh | 8 +++----- ..._to_container_edge_with_ebpf_proc_fallback_test.sh | 8 +++----- integration/320_container_edge_cross_host_2_test.sh | 7 ++----- integration/330_process_edge_test.sh | 3 ++- integration/340_process_edge_across_host_2_test.sh | 2 +- integration/config.sh | 11 +++++++++++ 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/integration/310_container_to_container_edge_test.sh b/integration/310_container_to_container_edge_test.sh index 307d4e5163..dbf9a4dd9a 100755 --- a/integration/310_container_to_container_edge_test.sh +++ b/integration/310_container_to_container_edge_test.sh @@ -7,11 +7,9 @@ start_suite "Test short lived connections between containers" weave_on "$HOST1" launch scope_on "$HOST1" launch -weave_proxy_on "$HOST1" run -d --name nginx nginx -weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ - wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ - sleep 1; \ -done" + +server_on "$HOST1" +client_on "$HOST1" wait_for_containers "$HOST1" 60 nginx client diff --git a/integration/311_container_to_container_edge_without_ebpf_test.sh b/integration/311_container_to_container_edge_without_ebpf_test.sh index 84b95f7255..dd841acd40 100755 --- a/integration/311_container_to_container_edge_without_ebpf_test.sh +++ b/integration/311_container_to_container_edge_without_ebpf_test.sh @@ -7,11 +7,9 @@ start_suite "Test short lived connections between containers, without ebpf conne weave_on "$HOST1" launch scope_on "$HOST1" launch --probe.ebpf.connections=false -weave_proxy_on "$HOST1" run -d --name nginx nginx -weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ - wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ - sleep 1; \ -done" + +server_on "$HOST1" +client_on "$HOST1" wait_for_containers "$HOST1" 60 nginx client diff --git a/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh b/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh index 44e9e6b126..5924077197 100755 --- a/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh +++ b/integration/313_container_to_container_edge_with_ebpf_proc_fallback_test.sh @@ -12,11 +12,9 @@ weave_on "$HOST1" launch DOCKER_HOST=tcp://${HOST1}:${DOCKER_PORT} CHECKPOINT_DISABLE=true \ WEAVESCOPE_DOCKER_ARGS="-v /tmp:/sys/kernel/debug/tracing:ro" \ "${SCOPE}" launch -weave_proxy_on "$HOST1" run -d --name nginx nginx -weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \ - wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ - sleep 1; \ -done" + +server_on "$HOST1" +client_on "$HOST1" wait_for_containers "$HOST1" 60 nginx client diff --git a/integration/320_container_edge_cross_host_2_test.sh b/integration/320_container_edge_cross_host_2_test.sh index 7e63b95e06..4e0a057a9b 100755 --- a/integration/320_container_edge_cross_host_2_test.sh +++ b/integration/320_container_edge_cross_host_2_test.sh @@ -11,11 +11,8 @@ weave_on "$HOST2" launch "$HOST1" "$HOST2" scope_on "$HOST1" launch scope_on "$HOST2" launch -weave_proxy_on "$HOST1" run -d --name nginx nginx -weave_proxy_on "$HOST2" run -d --name client alpine /bin/sh -c "while true; do \ - wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ - sleep 1; \ -done" +server_on "$HOST1" +client_on "$HOST2" sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports diff --git a/integration/330_process_edge_test.sh b/integration/330_process_edge_test.sh index 414e564934..c78629c40c 100755 --- a/integration/330_process_edge_test.sh +++ b/integration/330_process_edge_test.sh @@ -7,7 +7,8 @@ start_suite "Test long connections (procspy) between processes" weave_on "$HOST1" launch scope_on "$HOST1" launch --probe.conntrack=false -weave_proxy_on "$HOST1" run -d --name nginx nginx + +server_on "$HOST1" weave_proxy_on "$HOST1" run -dti --name client alpine /bin/sh -c "while true; do \ nc nginx.weave.local 80 || true; \ sleep 1; \ diff --git a/integration/340_process_edge_across_host_2_test.sh b/integration/340_process_edge_across_host_2_test.sh index 0ead397f89..60442e3f4e 100755 --- a/integration/340_process_edge_across_host_2_test.sh +++ b/integration/340_process_edge_across_host_2_test.sh @@ -11,7 +11,7 @@ weave_on "$HOST2" launch "$HOST1" "$HOST2" scope_on "$HOST1" launch --probe.conntrack=false scope_on "$HOST2" launch --probe.conntrack=false -weave_proxy_on "$HOST1" run -d --name nginx nginx +server_on "$HOST1" weave_proxy_on "$HOST2" run -dti --name client alpine /bin/sh -c "while true; do \ nc nginx.weave.local 80 || true; \ sleep 1; \ diff --git a/integration/config.sh b/integration/config.sh index a69a265386..2c51df5a25 100644 --- a/integration/config.sh +++ b/integration/config.sh @@ -35,6 +35,17 @@ weave_proxy_on() { DOCKER_PORT=12375 docker_on "$host" "$@" } +server_on() { + weave_proxy_on "$1" run -d --name nginx nginx +} + +client_on() { + weave_proxy_on "$1" run -d --name client alpine /bin/sh -c "while true; do \ + wget http://nginx.weave.local:80/ -O - >/dev/null || true; \ + sleep 1; \ + done" +} + scope_end_suite() { end_suite for host in $HOSTS; do