From e7ddc97b4578c281de6559fcd26aa1d68de4531f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 21 Jun 2000 01:16:06 +0000 Subject: [PATCH] Add stub test --- bin/tests/system/stub/clean.sh | 23 +++++++++ bin/tests/system/stub/knowngood.dig.out.norec | 21 ++++++++ bin/tests/system/stub/knowngood.dig.out.rec | 24 +++++++++ bin/tests/system/stub/ns1/named.conf | 15 ++++++ bin/tests/system/stub/ns1/root.db | 13 +++++ bin/tests/system/stub/ns2/child.example.db | 11 ++++ bin/tests/system/stub/ns2/named.conf | 19 +++++++ bin/tests/system/stub/ns2/root.hint | 3 ++ bin/tests/system/stub/ns3/example.db | 11 ++++ bin/tests/system/stub/ns3/named.conf | 26 ++++++++++ bin/tests/system/stub/ns3/root.hint | 3 ++ bin/tests/system/stub/tests.sh | 50 +++++++++++++++++++ 12 files changed, 219 insertions(+) create mode 100644 bin/tests/system/stub/clean.sh create mode 100644 bin/tests/system/stub/knowngood.dig.out.norec create mode 100644 bin/tests/system/stub/knowngood.dig.out.rec create mode 100644 bin/tests/system/stub/ns1/named.conf create mode 100644 bin/tests/system/stub/ns1/root.db create mode 100644 bin/tests/system/stub/ns2/child.example.db create mode 100644 bin/tests/system/stub/ns2/named.conf create mode 100644 bin/tests/system/stub/ns2/root.hint create mode 100644 bin/tests/system/stub/ns3/example.db create mode 100644 bin/tests/system/stub/ns3/named.conf create mode 100644 bin/tests/system/stub/ns3/root.hint create mode 100644 bin/tests/system/stub/tests.sh diff --git a/bin/tests/system/stub/clean.sh b/bin/tests/system/stub/clean.sh new file mode 100644 index 0000000000..a76e554720 --- /dev/null +++ b/bin/tests/system/stub/clean.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Copyright (C) 2000 Internet Software Consortium. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS +# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE +# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +# SOFTWARE. + +# +# Clean up after zone transfer tests. +# + +rm -f ns2/child.example.st dig.out.ns2 + diff --git a/bin/tests/system/stub/knowngood.dig.out.norec b/bin/tests/system/stub/knowngood.dig.out.norec new file mode 100644 index 0000000000..0aa9c0dbbf --- /dev/null +++ b/bin/tests/system/stub/knowngood.dig.out.norec @@ -0,0 +1,21 @@ + +; <<>> DiG 8.2 <<>> -p @10.53.0.3 +norec data.child.example txt +; (1 server found) +;; res options: init defnam dnsrch +;; got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 216 +;; flags: qr ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1 +;; QUERY SECTION: +;; data.child.example, type = TXT, class = IN + +;; AUTHORITY SECTION: +child.example. 5M IN NS ns2.child.example. + +;; ADDITIONAL SECTION: +ns2.child.example. 5M IN A 10.53.0.2 + +;; Total query time: 3 msec +;; FROM: draco to SERVER: 10.53.0.3 +;; WHEN: Wed Jun 21 10:58:37 2000 +;; MSG SIZE sent: 36 rcvd: 70 + diff --git a/bin/tests/system/stub/knowngood.dig.out.rec b/bin/tests/system/stub/knowngood.dig.out.rec new file mode 100644 index 0000000000..da6c3aa716 --- /dev/null +++ b/bin/tests/system/stub/knowngood.dig.out.rec @@ -0,0 +1,24 @@ + +; <<>> DiG 8.2 <<>> -p @10.53.0.3 data.child.example txt +; (1 server found) +;; res options: init recurs defnam dnsrch +;; got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6 +;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 +;; QUERY SECTION: +;; data.child.example, type = TXT, class = IN + +;; ANSWER SECTION: +data.child.example. 5M IN TXT "some" "test" "data" + +;; AUTHORITY SECTION: +child.example. 5M IN NS ns2.child.example. + +;; ADDITIONAL SECTION: +ns2.child.example. 5M IN A 10.53.0.2 + +;; Total query time: 8 msec +;; FROM: draco to SERVER: 10.53.0.3 +;; WHEN: Wed Jun 21 10:58:54 2000 +;; MSG SIZE sent: 36 rcvd: 97 + diff --git a/bin/tests/system/stub/ns1/named.conf b/bin/tests/system/stub/ns1/named.conf new file mode 100644 index 0000000000..1fdf78d6eb --- /dev/null +++ b/bin/tests/system/stub/ns1/named.conf @@ -0,0 +1,15 @@ +options { + query-source address 10.53.0.1; + port 5300; + directory "."; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 {none;}; + recursion no; + notify yes; +}; + +zone "." { + type master; + file "root.db"; +}; diff --git a/bin/tests/system/stub/ns1/root.db b/bin/tests/system/stub/ns1/root.db new file mode 100644 index 0000000000..72deec32ff --- /dev/null +++ b/bin/tests/system/stub/ns1/root.db @@ -0,0 +1,13 @@ +$TTL 300 +. IN SOA gson.nominum.com. a.root.servers.nil. ( + 2000042100 ; serial + 600 ; refresh + 600 ; retry + 1200 ; expire + 600 ; minimum + ) +. NS a.root-servers.nil. +a.root-servers.nil. A 10.53.0.1 + +example. NS ns3.example. +ns3.example. A 10.53.0.3 diff --git a/bin/tests/system/stub/ns2/child.example.db b/bin/tests/system/stub/ns2/child.example.db new file mode 100644 index 0000000000..010dffba4c --- /dev/null +++ b/bin/tests/system/stub/ns2/child.example.db @@ -0,0 +1,11 @@ +$TTL 300 ; 5 minutes +child.example. IN SOA ns2.child.example. hostmaster.child.example. ( + 2000042795 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +child.example. NS ns2.child.example. +ns2.child.example. A 10.53.0.2 +data TXT some test data diff --git a/bin/tests/system/stub/ns2/named.conf b/bin/tests/system/stub/ns2/named.conf new file mode 100644 index 0000000000..cd3298550d --- /dev/null +++ b/bin/tests/system/stub/ns2/named.conf @@ -0,0 +1,19 @@ +options { + query-source address 10.53.0.2; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 {none;}; + recursion no; + notify yes; +}; + +zone "." { + type hint; + file "root.hint"; +}; + +zone "child.example" { + type master; + file "child.example.db"; +}; diff --git a/bin/tests/system/stub/ns2/root.hint b/bin/tests/system/stub/ns2/root.hint new file mode 100644 index 0000000000..753aa03684 --- /dev/null +++ b/bin/tests/system/stub/ns2/root.hint @@ -0,0 +1,3 @@ +$TTL 999999 +. IN NS a.root-servers.nil. +a.root-servers.nil. IN A 10.53.0.1 diff --git a/bin/tests/system/stub/ns3/example.db b/bin/tests/system/stub/ns3/example.db new file mode 100644 index 0000000000..9c5c9034ab --- /dev/null +++ b/bin/tests/system/stub/ns3/example.db @@ -0,0 +1,11 @@ +$ORIGIN . +$TTL 300 ; 5 minutes +example IN SOA ns3.example. hostmaster.example. ( + 2000042795 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +example. NS ns3.example. +ns3.example. A 10.53.0.3 diff --git a/bin/tests/system/stub/ns3/named.conf b/bin/tests/system/stub/ns3/named.conf new file mode 100644 index 0000000000..2310ca7203 --- /dev/null +++ b/bin/tests/system/stub/ns3/named.conf @@ -0,0 +1,26 @@ +options { + query-source address 10.53.0.3; + port 5300; + directory "."; + pid-file "named.pid"; + listen-on { 10.53.0.3; }; + listen-on-v6 {none;}; + recursion yes; + notify yes; +}; + +zone "." { + type hint; + file "root.hint"; +}; + +zone "example" { + type master; + file "example.db"; +}; + +zone "child.example" { + type stub; + file "child.example.st"; + masters { 10.53.0.2; }; +}; diff --git a/bin/tests/system/stub/ns3/root.hint b/bin/tests/system/stub/ns3/root.hint new file mode 100644 index 0000000000..753aa03684 --- /dev/null +++ b/bin/tests/system/stub/ns3/root.hint @@ -0,0 +1,3 @@ +$TTL 999999 +. IN NS a.root-servers.nil. +a.root-servers.nil. IN A 10.53.0.1 diff --git a/bin/tests/system/stub/tests.sh b/bin/tests/system/stub/tests.sh new file mode 100644 index 0000000000..0c1ca1650b --- /dev/null +++ b/bin/tests/system/stub/tests.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Copyright (C) 2000 Internet Software Consortium. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS +# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE +# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +# SOFTWARE. + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +# +# Perform tests +# + +# sleep 5 + +status=0; +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd data.child.example. \ + @10.53.0.3 axfr -p 5300 > dig.out.ns3 +status=`expr $status + $?` +grep "; Transfer failed." dig.out.ns3 +status=`expr $status + $?` + +$DIG +tcp +nosea +nostat +noquest +nocomm +nocmd +norec \ + data.child.example. @10.53.0.3 txt -p 5300 > dig.out.ns3 +status=`expr $status + $?` +$PERL ../digcomp.pl knowngood.dig.out.norec dig.out.ns3 +status=`expr $status + $?` + +$DIG +tcp +nosea +nostat +noquest +nocomm +nocmd +rec \ + data.child.example. @10.53.0.3 txt -p 5300 > dig.out.ns3 +status=`expr $status + $?` +$PERL ../digcomp.pl knowngood.dig.out.rec dig.out.ns3 +status=`expr $status + $?` + +if [ $status != 0 ]; then + echo "R:FAIL" +else + echo "R:PASS" +fi