]> granicus.if.org Git - pdns/commitdiff
add test for simple ghost domain
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Mon, 28 Jan 2013 10:02:31 +0000 (10:02 +0000)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Mon, 28 Jan 2013 10:02:31 +0000 (10:02 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3084 d19b8d6e-7fed-0310-83ef-9ca221ded41b

regression-tests.recursor/config.sh
regression-tests.recursor/ghost-2/command [new file with mode: 0755]
regression-tests.recursor/ghost-2/description [new file with mode: 0644]
regression-tests.recursor/ghost-2/expected_result [new file with mode: 0644]

index b8996d26700243f588eb80bd97f4f1103a7e6cde..ec7b85d37889f7f301fab4aafd185bc1dd2f9e34 100755 (executable)
@@ -175,6 +175,24 @@ ns.1.ghost.example.net.   10 IN A   $PREFIX.18
 ns.2.ghost.example.net.   10 IN A   $PREFIX.19
 EOF
 
+cat > $PREFIX.17/prequery.lua <<EOF
+require 'posix'
+
+function prequery ( dnspacket )
+    qname, qtype = dnspacket:getQuestion()
+    if (string.sub(qname, -20) == ".1.ghost.example.net" and posix.stat('drop-1')) or
+       (string.sub(qname, -20) == ".2.ghost.example.net" and posix.stat('drop-2'))
+    then
+        dnspacket:setRcode(pdns.NXDOMAIN)
+        ret = {}
+        ret[1] = {qname="ghost.example.net", qtype=pdns.SOA, content="$SOA", place=2}
+        dnspacket:addRecords(ret)
+        return true
+    end
+    return false
+end
+EOF
+
 ### ghost domain with ever-changing NSset
 mkdir $PREFIX.18
 cat > $PREFIX.18/1.ghost.example.net.zone <<EOF
diff --git a/regression-tests.recursor/ghost-2/command b/regression-tests.recursor/ghost-2/command
new file mode 100755 (executable)
index 0000000..e37f34d
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+. vars
+rm configs/$PREFIX.17/drop-2
+cleandig a.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+touch configs/$PREFIX.17/drop-2
+cleandig b.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+cleandig c.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+cleandig d.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+sleep 5
+cleandig e.www.2.ghost.example.net a | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
diff --git a/regression-tests.recursor/ghost-2/description b/regression-tests.recursor/ghost-2/description
new file mode 100644 (file)
index 0000000..b50cee0
--- /dev/null
@@ -0,0 +1,2 @@
+Simple ghost domain test - delegation is removed and receiver does no tricks
+to prolong existence other than sending AUTHORITY with every response.
diff --git a/regression-tests.recursor/ghost-2/expected_result b/regression-tests.recursor/ghost-2/expected_result
new file mode 100644 (file)
index 0000000..a90fcc6
--- /dev/null
@@ -0,0 +1,15 @@
+0      a.www.2.ghost.example.net.      IN      A       3600    192.0.2.8
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='a.www.2.ghost.example.net.', qtype=A
+0      b.www.2.ghost.example.net.      IN      A       3600    192.0.2.8
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='b.www.2.ghost.example.net.', qtype=A
+0      c.www.2.ghost.example.net.      IN      A       3600    192.0.2.8
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='c.www.2.ghost.example.net.', qtype=A
+1      ghost.example.net.      IN      SOA     3600    ns.example.net. hostmaster.example.net. 1 3600 1800 1209600 300
+Rcode: 3, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='d.www.2.ghost.example.net.', qtype=A
+1      ghost.example.net.      IN      SOA     3600    ns.example.net. hostmaster.example.net. 1 3600 1800 1209600 300
+Rcode: 3, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='e.www.2.ghost.example.net.', qtype=A