diff --git a/test/100_cross_hosts_test.sh b/test/100_cross_hosts_test.sh index 6073b581..7d95a519 100755 --- a/test/100_cross_hosts_test.sh +++ b/test/100_cross_hosts_test.sh @@ -8,16 +8,16 @@ C2=10.2.1.7 start_suite "Ping over cross-host weave network" for HOST in $HOST1 $HOST2; do - run_on $HOST sudo $WEAVE stop || true - run_on $HOST sudo $WEAVE stop-dns || true + weave_on $HOST stop || true + weave_on $HOST stop-dns || true docker_on $HOST rm -f c1 c2 || true done -run_on $HOST1 sudo $WEAVE launch -run_on $HOST2 sudo $WEAVE launch $HOST1 +weave_on $HOST1 launch +weave_on $HOST2 launch $HOST1 -run_on $HOST2 sudo $WEAVE run $C2/24 -t --name=c2 ubuntu -run_on $HOST1 sudo $WEAVE run $C1/24 -t --name=c1 ubuntu +weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu +weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu ok=$(docker -H tcp://$HOST1:2375 exec -i c1 sh -c "ping -q -c 4 $C2 >&2 && echo ok") assert "echo $ok" "ok" diff --git a/test/110_encryption_test.sh b/test/110_encryption_test.sh index 9ac8a903..ecf1f857 100755 --- a/test/110_encryption_test.sh +++ b/test/110_encryption_test.sh @@ -8,16 +8,16 @@ C2=10.2.1.7 start_suite "Ping over encrypted cross-host weave network" for HOST in $HOST1 $HOST2; do - run_on $HOST sudo $WEAVE stop || true - run_on $HOST sudo $WEAVE stop-dns || true + weave_on $HOST stop || true + weave_on $HOST stop-dns || true docker_on $HOST rm -f c1 c2 || true done -run_on $HOST1 sudo $WEAVE launch -password notverysecure -run_on $HOST2 sudo $WEAVE launch -password notverysecure $HOST1 +weave_on $HOST1 launch -password notverysecure +weave_on $HOST2 launch -password notverysecure $HOST1 -run_on $HOST2 sudo $WEAVE run $C2/24 -t --name=c2 ubuntu -run_on $HOST1 sudo $WEAVE run $C1/24 -t --name=c1 ubuntu +weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu +weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu ok=$(docker -H tcp://$HOST1:2375 exec -i c1 sh -c "ping -q -c 4 $C2 >&2 && echo ok") assert "echo $ok" "ok" diff --git a/test/200_dns_test.sh b/test/200_dns_test.sh index a918f699..a05ced4e 100755 --- a/test/200_dns_test.sh +++ b/test/200_dns_test.sh @@ -7,14 +7,14 @@ C2=10.2.0.34 start_suite "Resolve names on a single host" -run_on $HOST1 sudo $WEAVE stop || true -run_on $HOST1 sudo $WEAVE stop-dns || true -run_on $HOST1 sudo $WEAVE launch-dns 10.2.254.1/24 +weave_on $HOST1 stop || true +weave_on $HOST1 stop-dns || true +weave_on $HOST1 launch-dns 10.2.254.1/24 docker_on $HOST1 rm -f c1 c2 || true -run_on $HOST1 sudo $WEAVE run $C2/24 -t --name=c2 -h seetwo.weave.local ubuntu -run_on $HOST1 sudo $WEAVE run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh +weave_on $HOST1 run $C2/24 -t --name=c2 -h seetwo.weave.local ubuntu +weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh ok=$(docker -H tcp://$HOST1:2375 exec -i c1 sh -c "dig +short seetwo.weave.local") assert "echo $ok" "$C2" diff --git a/test/210_dns_multicast_test.sh b/test/210_dns_multicast_test.sh index 2474c109..ef720f73 100755 --- a/test/210_dns_multicast_test.sh +++ b/test/210_dns_multicast_test.sh @@ -8,19 +8,19 @@ C2=10.2.3.34 start_suite "Resolve names across hosts" for host in $HOST1 $HOST2; do - run_on $host sudo $WEAVE stop || true - run_on $host sudo $WEAVE stop-dns || true + weave_on $host stop || true + weave_on $host stop-dns || true docker_on $host rm -f c1 c2 || true done -run_on $HOST1 sudo $WEAVE launch -run_on $HOST2 sudo $WEAVE launch $HOST1 +weave_on $HOST1 launch +weave_on $HOST2 launch $HOST1 -run_on $HOST1 sudo $WEAVE launch-dns 10.2.254.1/24 -debug -run_on $HOST2 sudo $WEAVE launch-dns 10.2.254.2/24 -debug +weave_on $HOST1 launch-dns 10.2.254.1/24 -debug +weave_on $HOST2 launch-dns 10.2.254.2/24 -debug -run_on $HOST2 sudo $WEAVE run $C2/24 -t --name=c2 -h seetwo.weave.local ubuntu -run_on $HOST1 sudo $WEAVE run --with-dns $C1/24 --name=c1 -t aanand/docker-dnsutils /bin/sh +weave_on $HOST2 run $C2/24 -t --name=c2 -h seetwo.weave.local ubuntu +weave_on $HOST1 run --with-dns $C1/24 --name=c1 -t aanand/docker-dnsutils /bin/sh ok=$(docker -H tcp://$HOST1:2375 exec -i c1 dig +short seetwo.weave.local) assert "echo $ok" "$C2" diff --git a/test/220_dns_custom_test.sh b/test/220_dns_custom_test.sh index 73c9d07e..835ebd98 100755 --- a/test/220_dns_custom_test.sh +++ b/test/220_dns_custom_test.sh @@ -7,14 +7,14 @@ C2=10.2.54.91 start_suite "Resolve names in custom domain" -run_on $HOST1 sudo $WEAVE stop || true -run_on $HOST1 sudo $WEAVE stop-dns || true -run_on $HOST1 sudo $WEAVE launch-dns 10.2.254.1/24 --localDomain foo.bar. +weave_on $HOST1 stop || true +weave_on $HOST1 stop-dns || true +weave_on $HOST1 launch-dns 10.2.254.1/24 --localDomain foo.bar. docker_on $HOST1 rm -f c1 c2 || true -run_on $HOST1 sudo $WEAVE run $C2/24 -t --name=c2 -h seetwo.foo.bar ubuntu -run_on $HOST1 sudo $WEAVE run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh +weave_on $HOST1 run $C2/24 -t --name=c2 -h seetwo.foo.bar ubuntu +weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh ok=$(docker -H tcp://$HOST1:2375 exec -i c1 sh -c "dig +short seetwo.foo.bar.") assert "echo $ok" "$C2" diff --git a/test/300_fallback_dns_test.sh b/test/300_fallback_dns_test.sh index 5a2ba74f..49131c59 100755 --- a/test/300_fallback_dns_test.sh +++ b/test/300_fallback_dns_test.sh @@ -4,11 +4,11 @@ start_suite "Resolve a non-weave address" -run_on $HOST1 sudo $WEAVE stop-dns || true -run_on $HOST1 sudo $WEAVE launch-dns 10.2.254.1/24 -debug +weave_on $HOST1 stop-dns || true +weave_on $HOST1 launch-dns 10.2.254.1/24 -debug docker_on $HOST1 rm -f c1 || true -run_on $HOST1 sudo $WEAVE run --with-dns 10.2.1.5/24 --name=c1 -t aanand/docker-dnsutils /bin/sh +weave_on $HOST1 run --with-dns 10.2.1.5/24 --name=c1 -t aanand/docker-dnsutils /bin/sh ok=$(docker -H tcp://$HOST1:2375 exec -i c1 dig +short -t MX weave.works) assert "test -n \"$ok\" && echo pass" "pass" diff --git a/test/config.sh b/test/config.sh index 7acba9ec..071738cb 100644 --- a/test/config.sh +++ b/test/config.sh @@ -49,6 +49,13 @@ docker_on() { docker -H tcp://$host:2375 $@ } +weave_on() { + host=$1 + shift 1 + greyly echo "Weave on $host: $@" + DOCKER_HOST=tcp://$host:2375 $WEAVE $@ +} + start_suite() { whitely echo $@ } @@ -57,5 +64,5 @@ end_suite() { whitely assert_end } -WEAVE=./bin/weave +WEAVE=../weave DOCKER_NS=./bin/docker-ns diff --git a/test/setup.sh b/test/setup.sh index 11b7767a..f6a7cee8 100755 --- a/test/setup.sh +++ b/test/setup.sh @@ -14,10 +14,8 @@ for HOST in $HOSTS; do docker_on $HOST load -i ../weave.tar docker_on $HOST load -i ../weavedns.tar docker_on $HOST load -i ../weaveexec.tar - run_on $HOST mkdir -p `dirname $WEAVE` - cat ../weave | run_on $HOST sh -c "cat > $WEAVE" + run_on $HOST mkdir -p bin cat ../bin/docker-ns | run_on $HOST sh -c "cat > $DOCKER_NS" - run_on $HOST chmod a+x $WEAVE run_on $HOST chmod a+x $DOCKER_NS run_on $HOST sudo service docker restart done