diff --git a/tests-extra/tests/ixfr/from_older/test.py b/tests-extra/tests/ixfr/from_older/test.py index bd13165a6..3be42b74f 100644 --- a/tests-extra/tests/ixfr/from_older/test.py +++ b/tests-extra/tests/ixfr/from_older/test.py @@ -17,6 +17,7 @@ t.start() serial_init = knot.zone_wait(zone) resp = knot.dig("example.com", "IXFR", serial=serial_init + 1) +resp.check_xfr() compare(resp.msg_count(), 1, "Only one message") compare(resp.count("SOA"), 1, "Only one RR in Answer section") diff --git a/tests-extra/tools/dnstest/response.py b/tests-extra/tools/dnstest/response.py index eb57a04bf..ed75fa153 100644 --- a/tests-extra/tools/dnstest/response.py +++ b/tests-extra/tools/dnstest/response.py @@ -139,6 +139,27 @@ class Response(object): self.check_record(section="answer", rtype=self.rtype, ttl=ttl, rdata=rdata, nordata=nordata) + def check_xfr(self, rcode="NOERROR"): + '''Checks XFR message''' + + self.resp, iter_copy = itertools.tee(self.resp) + + # Get the first message. + for msg in iter_copy: + question = msg.question[0] + compare(question.rdclass, self.rclass, "QCLASS") + compare(question.rdtype, self.rtype, "QTYPE") + + # Check rcode. + if type(rcode) is not str: + rc = dns.rcode.to_text(rcode) + else: + rc = rcode + compare(dns.rcode.to_text(msg.rcode()), rc, "RCODE") + + # Check the first message only. + break + def check_edns(self, nsid=None, buff_size=None): compare(self.resp.edns, 0, "EDNS VERSION")