From 35058a1dde6170b97d8fd2f047a3a6ed87532a4a Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 30 Sep 2015 22:38:48 +0100 Subject: [PATCH 1/3] refactor: put negative DNS queries in one test suite --- test/200_dns_test.sh | 2 -- test/250_dns_negative_test.sh | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/200_dns_test.sh b/test/200_dns_test.sh index f4d8c998..78a845a5 100755 --- a/test/200_dns_test.sh +++ b/test/200_dns_test.sh @@ -15,6 +15,4 @@ start_container_with_dns $HOST1 $C1/24 --name=c1 assert_dns_record $HOST1 c1 $NAME $C2 -assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q 'status: NXDOMAIN'" - end_suite diff --git a/test/250_dns_negative_test.sh b/test/250_dns_negative_test.sh index f89b6698..749a8bf0 100755 --- a/test/250_dns_negative_test.sh +++ b/test/250_dns_negative_test.sh @@ -6,7 +6,11 @@ start_suite "Negative DNS queries" weave_on $HOST1 launch start_container_with_dns $HOST1 --name c1 -assert_raises "exec_on $HOST1 c1 dig A foo.weave.local | grep 'status: NXDOMAIN'" -assert_raises "exec_on $HOST1 c1 dig A foo.invalid | grep 'status: NXDOMAIN'" + +# unknown name, invalid domain, and unsupported query types should all +# trigger NXDOMAIN +assert_raises "exec_on $HOST1 c1 dig A foo.weave.local | grep -q 'status: NXDOMAIN'" +assert_raises "exec_on $HOST1 c1 dig A foo.invalid | grep -q 'status: NXDOMAIN'" +assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q 'status: NXDOMAIN'" end_suite From 3e5cdd8bf2988840172e4f0ec919b644d802bc7b Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 30 Sep 2015 22:42:27 +0100 Subject: [PATCH 2/3] refactor: remove pointless NXDOMAIN tests --- test/255_dns_restart_test.sh | 2 -- test/295_dns_large_response_test.sh | 2 -- 2 files changed, 4 deletions(-) diff --git a/test/255_dns_restart_test.sh b/test/255_dns_restart_test.sh index 9c8a0e54..d1d8e198 100755 --- a/test/255_dns_restart_test.sh +++ b/test/255_dns_restart_test.sh @@ -14,12 +14,10 @@ start_container $HOST1 $C2/24 --name=c2 -h $NAME start_container_with_dns $HOST1 $C1/24 --name=c1 assert_dns_record $HOST1 c1 $NAME $C2 -assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q 'status: NXDOMAIN'" weave_on $HOST1 stop weave_on $HOST1 launch assert_dns_record $HOST1 c1 $NAME $C2 -assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q 'status: NXDOMAIN'" end_suite diff --git a/test/295_dns_large_response_test.sh b/test/295_dns_large_response_test.sh index 81dba0fb..96c35153 100755 --- a/test/295_dns_large_response_test.sh +++ b/test/295_dns_large_response_test.sh @@ -16,8 +16,6 @@ for i in $(seq $N); do done weave_on $HOST1 dns-add $IPS $CID -h $NAME -assert_raises "exec_on $HOST1 c0 dig MX $NAME | grep -q 'status: NXDOMAIN'" - check() { assert "exec_on $HOST1 c0 dig +short $* $NAME A | grep -v ';;' | wc -l" $N } From 3795c14931b143338302d6c26ef204282944a771 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 30 Sep 2015 22:57:10 +0100 Subject: [PATCH 3/3] better --- test/250_dns_negative_test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/250_dns_negative_test.sh b/test/250_dns_negative_test.sh index 749a8bf0..bcab7baa 100755 --- a/test/250_dns_negative_test.sh +++ b/test/250_dns_negative_test.sh @@ -7,10 +7,10 @@ start_suite "Negative DNS queries" weave_on $HOST1 launch start_container_with_dns $HOST1 --name c1 -# unknown name, invalid domain, and unsupported query types should all -# trigger NXDOMAIN -assert_raises "exec_on $HOST1 c1 dig A foo.weave.local | grep -q 'status: NXDOMAIN'" -assert_raises "exec_on $HOST1 c1 dig A foo.invalid | grep -q 'status: NXDOMAIN'" -assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q 'status: NXDOMAIN'" +# unsupported query types, unknown names, and unknown domains should +# all trigger NXDOMAIN +assert_raises "exec_on $HOST1 c1 dig MX c1.weave.local | grep -q 'status: NXDOMAIN'" +assert_raises "exec_on $HOST1 c1 dig A xx.weave.local | grep -q 'status: NXDOMAIN'" +assert_raises "exec_on $HOST1 c1 dig A xx.invalid | grep -q 'status: NXDOMAIN'" end_suite