Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1117 from weaveworks/multi_hop_tests
Browse files Browse the repository at this point in the history
Multi hop tests
  • Loading branch information
tomwilkie committed Jul 13, 2015
2 parents 5e43f0f + 57a4371 commit 24a4d65
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
41 changes: 41 additions & 0 deletions test/120_discovery_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#! /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 --ipalloc-range="" $HOST1
weave_on $HOST3 launch-router $1 $HOST2
}

start_suite "Peer discovery, multi-hop routing and gossip forwarding"

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

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
# 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'"

end_suite
2 changes: 1 addition & 1 deletion test/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion test/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion test/gce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 24a4d65

Please sign in to comment.