From 210b9260647e404627df8a5277b275f1c4cc747c Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 11 Jul 2015 12:31:00 +0100 Subject: [PATCH 1/4] increase number of test VMs from 2 to 3 --- test/Vagrantfile | 2 +- test/config.sh | 3 ++- test/gce.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Vagrantfile b/test/Vagrantfile index 73be67e3db..1a888f4068 100644 --- a/test/Vagrantfile +++ b/test/Vagrantfile @@ -5,7 +5,7 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.require_version ">= 1.7.0" # these ought to match what is in config.sh -n_machines = 2 +n_machines = 3 ip_prefix = "192.168.48" ip_suffix_base = 10 diff --git a/test/config.sh b/test/config.sh index 31159e4a01..3d13699996 100644 --- a/test/config.sh +++ b/test/config.sh @@ -12,7 +12,7 @@ fi SOURCED_CONFIG_SH=true # these ought to match what is in Vagrantfile -N_MACHINES=${N_MACHINES:-2} +N_MACHINES=${N_MACHINES:-3} IP_PREFIX=${IP_PREFIX:-192.168.48} IP_SUFFIX_BASE=${IP_SUFFIX_BASE:-10} @@ -26,6 +26,7 @@ fi # these are used by the tests HOST1=$(echo $HOSTS | cut -f 1 -d ' ') HOST2=$(echo $HOSTS | cut -f 2 -d ' ') +HOST3=$(echo $HOSTS | cut -f 3 -d ' ') . "$DIR/assert.sh" diff --git a/test/gce.sh b/test/gce.sh index 02738928d9..192af73320 100755 --- a/test/gce.sh +++ b/test/gce.sh @@ -13,7 +13,7 @@ PROJECT=${PROJECT:-positive-cocoa-90213} IMAGE=ubuntu-14-04 TEMPLATE_NAME="test-template-2" ZONE=us-central1-a -NUM_HOSTS=2 +NUM_HOSTS=3 SUFFIX="" if [ -n "$CIRCLECI" ]; then SUFFIX="-${CIRCLE_BUILD_NUM}-$CIRCLE_NODE_INDEX" From 2a0bc91f86f8d5485a3487f16902f80ef547f6fc Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 11 Jul 2015 12:33:25 +0100 Subject: [PATCH 2/4] add test for peer discovery and multi-hop routing --- test/120_discovery_test.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 test/120_discovery_test.sh diff --git a/test/120_discovery_test.sh b/test/120_discovery_test.sh new file mode 100755 index 0000000000..2d6e313f51 --- /dev/null +++ b/test/120_discovery_test.sh @@ -0,0 +1,34 @@ +#! /bin/bash + +. ./config.sh + +C1=10.2.1.41 +C3=10.2.1.71 + +launch_all() { + weave_on $HOST1 launch-router $1 + weave_on $HOST2 launch-router $1 $HOST1 + weave_on $HOST3 launch-router $1 $HOST2 +} + +start_suite "Peer discovery and multi-hop routing" + +launch_all + +start_container $HOST1 $C1/24 --name=c1 +start_container $HOST3 $C3/24 --name=c3 + +assert_raises "exec_on $HOST1 c1 $PING $C3" +stop_router_on $HOST2 +assert_raises "exec_on $HOST1 c1 $PING $C3" + +stop_router_on $HOST1 +stop_router_on $HOST3 + +launch_all --no-discovery + +assert_raises "exec_on $HOST1 c1 $PING $C3" +stop_router_on $HOST2 +assert_raises "exec_on $HOST1 c1 sh -c '! $PING $C3'" + +end_suite From 1d2e6b4c565c961524579f3bb3f25b999114942c Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 11 Jul 2015 14:13:40 +0100 Subject: [PATCH 3/4] test gossip forwarding --- test/120_discovery_test.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/120_discovery_test.sh b/test/120_discovery_test.sh index 2d6e313f51..c774ad16ff 100755 --- a/test/120_discovery_test.sh +++ b/test/120_discovery_test.sh @@ -7,11 +7,11 @@ C3=10.2.1.71 launch_all() { weave_on $HOST1 launch-router $1 - weave_on $HOST2 launch-router $1 $HOST1 - weave_on $HOST3 launch-router $1 $HOST2 + weave_on $HOST2 launch-router $1 --ipalloc-range="" $HOST1 + weave_on $HOST3 launch-router $1 $HOST2 } -start_suite "Peer discovery and multi-hop routing" +start_suite "Peer discovery, multi-hop routing and gossip forwarding" launch_all @@ -28,6 +28,11 @@ stop_router_on $HOST3 launch_all --no-discovery assert_raises "exec_on $HOST1 c1 $PING $C3" + +# this stalls if gossip forwarding doesn't work. We wait for slightly +# longer than the gossip interval (30s) before giving up. +assert_raises "timeout 40 cat <( start_container $HOST3 )" + stop_router_on $HOST2 assert_raises "exec_on $HOST1 c1 sh -c '! $PING $C3'" From 57a4371e9f7b84787b7ed91296e11bf5c7017bc0 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 11 Jul 2015 16:31:16 +0100 Subject: [PATCH 4/4] attempt to cure spurious test failures --- test/120_discovery_test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/120_discovery_test.sh b/test/120_discovery_test.sh index c774ad16ff..447b3721a8 100755 --- a/test/120_discovery_test.sh +++ b/test/120_discovery_test.sh @@ -27,6 +27,8 @@ stop_router_on $HOST3 launch_all --no-discovery +sleep 5 # give topology gossip some time to propagate + assert_raises "exec_on $HOST1 c1 $PING $C3" # this stalls if gossip forwarding doesn't work. We wait for slightly