From e5b1cc21a93a0697709318644cfbc06c15de488a Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Thu, 11 Jun 2015 16:45:49 +0100 Subject: [PATCH] Smoke test for new weave script DNS behaviour --- test/280_with_or_without_dns_test.sh | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 test/280_with_or_without_dns_test.sh diff --git a/test/280_with_or_without_dns_test.sh b/test/280_with_or_without_dns_test.sh new file mode 100755 index 00000000..5d6e0de5 --- /dev/null +++ b/test/280_with_or_without_dns_test.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +. ./config.sh + +IP=10.2.0.34 +TARGET=seetwo.weave.local +TARGET_IP=10.2.0.78 + +assert_no_resolution() { + container=$(weave_on $HOST1 run "$@" $IP/24 -t $DNS_IMAGE /bin/sh) + assert_no_dns_record $HOST1 "$container" $TARGET + docker_on $HOST1 rm -f "$container" >/dev/null +} + +assert_resolution() { + container=$(weave_on $HOST1 run "$@" $IP/24 -t $DNS_IMAGE /bin/sh) + assert_dns_record $HOST1 "$container" $TARGET $TARGET_IP + docker_on $HOST1 rm -f "$container" >/dev/null +} + +start_suite "With or without DNS test" + +weave_on $HOST1 launch + +DNS_IP=$(weave_on $HOST1 docker-bridge-ip) + +# Assert behaviour without weaveDNS running +assert_no_resolution --without-dns +assert_no_resolution +assert_no_resolution --with-dns + +weave_on $HOST1 launch-dns 10.2.254.1/24 $WEAVEDNS_ARGS +start_container $HOST1 $TARGET_IP/24 --name c2 -h $TARGET + +# Assert behaviour with weaveDNS running +assert_no_resolution --without-dns +assert_resolution +assert_resolution --with-dns + +end_suite