summaryrefslogtreecommitdiff
path: root/testdata/stub_udp.tdir
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/stub_udp.tdir')
-rw-r--r--testdata/stub_udp.tdir/stub_udp.conf18
-rw-r--r--testdata/stub_udp.tdir/stub_udp.dsc16
-rw-r--r--testdata/stub_udp.tdir/stub_udp.post10
-rw-r--r--testdata/stub_udp.tdir/stub_udp.pre35
-rw-r--r--testdata/stub_udp.tdir/stub_udp.test37
-rw-r--r--testdata/stub_udp.tdir/stub_udp.testns46
6 files changed, 162 insertions, 0 deletions
diff --git a/testdata/stub_udp.tdir/stub_udp.conf b/testdata/stub_udp.tdir/stub_udp.conf
new file mode 100644
index 0000000000000..c8e2ae26ef943
--- /dev/null
+++ b/testdata/stub_udp.tdir/stub_udp.conf
@@ -0,0 +1,18 @@
+server:
+ verbosity: 2
+ # num-threads: 1
+ interface: 127.0.0.1
+ port: @PORT@
+ use-syslog: no
+ directory: ""
+ pidfile: "unbound.pid"
+ chroot: ""
+ username: ""
+ do-not-query-localhost: no
+stub-zone:
+ name: "example.com"
+ stub-addr: "127.0.0.1@@TOPORT@"
+# a k a root hints
+stub-zone:
+ name: "."
+ stub-addr: "127.0.0.1@@TOPORT@"
diff --git a/testdata/stub_udp.tdir/stub_udp.dsc b/testdata/stub_udp.tdir/stub_udp.dsc
new file mode 100644
index 0000000000000..c76c8995ed4f9
--- /dev/null
+++ b/testdata/stub_udp.tdir/stub_udp.dsc
@@ -0,0 +1,16 @@
+BaseName: stub_udp
+Version: 1.0
+Description: Stub server contacted via UDP.
+CreationDate: Tue Sep 30 15:10:00 CEST 2008
+Maintainer: dr. W.C.A. Wijngaards
+Category:
+Component:
+CmdDepends:
+Depends:
+Help:
+Pre: stub_udp.pre
+Post: stub_udp.post
+Test: stub_udp.test
+AuxFiles:
+Passed:
+Failure:
diff --git a/testdata/stub_udp.tdir/stub_udp.post b/testdata/stub_udp.tdir/stub_udp.post
new file mode 100644
index 0000000000000..c9216ed749c11
--- /dev/null
+++ b/testdata/stub_udp.tdir/stub_udp.post
@@ -0,0 +1,10 @@
+# #-- stub_udp.post --#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# source the test var file when it's there
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+#
+# do your teardown here
+. ../common.sh
+kill_pid $FWD_PID
+kill_pid $UNBOUND_PID
diff --git a/testdata/stub_udp.tdir/stub_udp.pre b/testdata/stub_udp.tdir/stub_udp.pre
new file mode 100644
index 0000000000000..d9dcaadedc85f
--- /dev/null
+++ b/testdata/stub_udp.tdir/stub_udp.pre
@@ -0,0 +1,35 @@
+# #-- stub_udp.pre--#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+. ../common.sh
+
+get_random_port 2
+UNBOUND_PORT=$RND_PORT
+FWD_PORT=$(($RND_PORT + 1))
+echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
+echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
+
+# start forwarder
+get_ldns_testns
+$LDNS_TESTNS -p $FWD_PORT stub_udp.testns >fwd.log 2>&1 &
+FWD_PID=$!
+echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
+
+# make config file
+sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < stub_udp.conf > ub.conf
+# start unbound in the background
+PRE="../.."
+$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
+UNBOUND_PID=$!
+echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
+
+cat .tpkg.var.test
+
+# wait for forwarder to come up
+wait_ldns_testns_up fwd.log
+
+# wait for unbound to come up
+wait_unbound_up unbound.log
+
diff --git a/testdata/stub_udp.tdir/stub_udp.test b/testdata/stub_udp.tdir/stub_udp.test
new file mode 100644
index 0000000000000..c417d2a04b2eb
--- /dev/null
+++ b/testdata/stub_udp.tdir/stub_udp.test
@@ -0,0 +1,37 @@
+# #-- stub_udp.test --#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+
+PRE="../.."
+# do the test
+echo "> dig www.example.com."
+dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
+echo "> cat logfiles"
+cat fwd.log
+cat unbound.log
+echo "> check answer"
+if grep "10.20.30.40" outfile; then
+ echo "OK"
+else
+ echo "Not OK"
+ exit 1
+fi
+
+
+# check delegations from cache by doing second test
+echo "> dig mail.example.com."
+dig @127.0.0.1 -p $UNBOUND_PORT mail.example.com. | tee outfile
+echo "> cat logfiles"
+cat fwd.log
+cat unbound.log
+echo "> check answer"
+if grep "10.20.30.66" outfile; then
+ echo "OK"
+else
+ echo "Not OK"
+ exit 1
+fi
+
+exit 0
diff --git a/testdata/stub_udp.tdir/stub_udp.testns b/testdata/stub_udp.tdir/stub_udp.testns
new file mode 100644
index 0000000000000..5d581b00a665d
--- /dev/null
+++ b/testdata/stub_udp.tdir/stub_udp.testns
@@ -0,0 +1,46 @@
+; nameserver test file
+$ORIGIN example.com.
+$TTL 3600
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+REPLY QR AA NOERROR
+ADJUST copy_id
+SECTION QUESTION
+www IN A
+SECTION ANSWER
+www IN A 10.20.30.40
+SECTION AUTHORITY
+@ IN NS ns.example.com.
+SECTION ADDITIONAL
+ns IN A 127.0.0.1
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+REPLY QR AA NOERROR
+ADJUST copy_id
+SECTION QUESTION
+mail IN A
+SECTION ANSWER
+mail IN A 10.20.30.66
+SECTION AUTHORITY
+@ IN NS ns.example.com.
+SECTION ADDITIONAL
+ns IN A 127.0.0.1
+ENTRY_END
+
+; root prime
+ENTRY_BEGIN
+MATCH opcode qtype qname
+REPLY QR AA NOERROR
+ADJUST copy_id
+SECTION QUESTION
+. IN NS
+SECTION ANSWER
+. IN NS root.server.
+SECTION AUTHORITY
+SECTION ADDITIONAL
+root.server. IN A 127.0.0.1
+ENTRY_END
+