Commit 340ab89c authored by Jan Včelák's avatar Jan Včelák 🚀

tests-extra: add tests for CNAME following

parent 808ede4e
$ORIGIN follow.
$TTL 10
@ SOA @ admin 1 10 10 120 10
NS @
A 10.0.0.1
AAAA fd00::a1
DNSKEY 256 3 13 Yg==
test CNAME @
@ NSEC test A NS SOA AAAA RRSIG NSEC DNSKEY
test NSEC @ CNAME RRSIG NSEC
@ RRSIG SOA 13 1 10 20150810112233 20250810112233 26125 @ YQ==
RRSIG A 13 1 10 20150810112233 20250810112233 26125 @ YQ==
RRSIG NS 13 1 10 20150810112233 20250810112233 26125 @ YQ==
RRSIG AAAA 13 1 10 20150810112233 20250810112233 26125 @ YQ==
RRSIG DNSKEY 13 1 10 20150810112233 20250810112233 26125 @ YQ==
RRSIG NSEC 13 1 10 20150810112233 20250810112233 26125 @ YQ==
test RRSIG CNAME 13 2 10 20150810112233 20250810112233 26125 @ YQ==
RRSIG NSEC 13 2 10 20150810112233 20250810112233 26125 @ YQ==
#!/usr/bin/env python3
"""
Basic checks for CNAME following.
- Query for CNAME, NSEC, RRSIG is not followed.
- Query for ANY meta type is not followed.
- Query for any other type is followed.
"""
from dnstest.test import Test
t = Test()
knot = t.server("knot")
zone = t.zone("follow", storage=".")
t.link(zone, knot)
t.start()
# follow CNAME (type exists)
resp = knot.dig("test.follow", "AAAA")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test.follow", "CNAME")
resp.check_rr("answer", "follow", "AAAA")
resp.check_empty("authority")
# follow CNAME (type doesn't exist)
resp = knot.dig("test.follow", "TXT")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test.follow", "CNAME")
resp.check_no_rr("answer", "test")
resp.check_rr("authority", "follow", "SOA")
# query for CNAME
resp = knot.dig("test.follow", "CNAME")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test.follow", "CNAME")
resp.check_no_rr("answer", "test")
resp.check_empty("authority")
# query for RRSIG
resp = knot.dig("test.follow", "RRSIG")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test.follow", "RRSIG")
resp.check_no_rr("answer", "test")
resp.check_empty("authority")
# query for NSEC
resp = knot.dig("test.follow", "NSEC")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test.follow", "NSEC")
resp.check_no_rr("answer", "test")
resp.check_empty("authority")
# query for ANY
resp = knot.dig("test.follow", "ANY")
resp.check(rcode="NOERROR", flags="AA")
resp.check_rr("answer", "test.follow", "CNAME")
resp.check_rr("answer", "test.follow", "NSEC")
resp.check_rr("answer", "test.follow", "RRSIG")
resp.check_no_rr("answer", "test")
resp.check_empty("authority")
t.end()
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