Commit 7f985098 authored by Jan Včelák's avatar Jan Včelák 🚀

tests-extra: add tests for Additional section content lookup

parent 9196d48c
$ORIGIN test.
$TTL 10
@ SOA a.ns admin 1 10 10 120 10
; NS - autoritative
@ NS a.ns
NS b.ns
NS ns.out.
a.ns A
AAAA fd00::a1
b.ns AAAA fd00::b1
AAAA fd00::b2
; NS - delegation
deleg NS a.ns.deleg
NS ns.out.
a.ns.deleg A
AAAA fd00::1:1
; MX
mx MX 10 a.mail
MX 20 b.mail
MX 30 mail.out.
a.mail A
b.mail AAAA fd00::1:1
srv SRV 10 0 1000 a.service
SRV 10 0 1000 b.service
SRV 10 0 1000 service.out.
a.service TXT "no address"
b.service AAAA fd00::2:1
AAAA fd00::2:2
AAAA fd00::2:3
ptr PTR target
target A
AAAA fd00::3:1
; MX with CNAME
mx-cname MX 10 cname.mail
cname.mail CNAME a.mail
#!/usr/bin/env python3
Basic checks of Additional section content.
- Query into a delegation scope adds glue into additionals.
- Query for NS/MX/SRV adds target A+AAAA into additionals.
- Query for other types (like PTR) does NOT cause lookup of additionals.
- Query for NS/MX/SRV pointing to CNAME does NOT cause lookup of additionals.
from dnstest.test import Test
t = Test()
knot = t.server("knot")
zone ="test", storage="."), knot)
# NS authoritative
resp = knot.dig("test", "NS")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test", "NS")
resp.check_rr("additional", "a.ns.test", "A")
resp.check_rr("additional", "a.ns.test", "AAAA")
resp.check_rr("additional", "b.ns.test", "AAAA")
# NS delegation
resp = knot.dig("www.deleg.test", "A")
resp.check(rcode="NOERROR", noflags="AA")
resp.check_rr("authority", "deleg.test", "NS")
resp.check_rr("additional", "a.ns.deleg.test", "A")
resp.check_rr("additional", "a.ns.deleg.test", "AAAA")
# MX record
resp = knot.dig("mx.test", "MX")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "mx.test", "MX")
resp.check_rr("additional", "a.mail.test", "A")
resp.check_rr("additional", "b.mail.test", "AAAA")
# SRV recordD (only AAAA in additionals)
resp = knot.dig("srv.test", "SRV")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "srv.test", "SRV")
resp.check_rr("additional", "b.service.test", "AAAA")
# PTR record (no additionals expected)
resp = knot.dig("ptr.test", "PTR")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "ptr.test", "PTR")
# MX through CNAME (no additionals expected)
resp = knot.dig("mx-cname.test", "MX")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "mx-cname.test", "MX")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment