summaryrefslogtreecommitdiffstats
path: root/tests-extra
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2024-09-06 09:52:05 +0200
committerDaniel Salzman <daniel.salzman@nic.cz>2024-09-06 09:52:05 +0200
commitc55625adf8cae8245b6606722af78337ef59c255 (patch)
tree30c864bdb84736d6ab1636c287f6f096474f36cc /tests-extra
parentRevert "distro/deb: move python3-sphinx to Build-Depends for man pages genera... (diff)
parenttests: all DDNS: randomize, unify and fix protocols and knsupdate usage... (diff)
downloadknot-c55625adf8cae8245b6606722af78337ef59c255.tar.xz
knot-c55625adf8cae8245b6606722af78337ef59c255.zip
Merge branch 'tests_ddns_unify' into 'master'
tests: all DDNS: randomize, unify and fix protocols and knsupdate usage... See merge request knot/knot-dns!1708
Diffstat (limited to 'tests-extra')
-rw-r--r--tests-extra/tests/ddns/basic/test.py153
-rw-r--r--tests-extra/tests/ddns/prereq/test.py56
-rw-r--r--tests-extra/tests/dnssec/offline_ksk/test.py1
-rw-r--r--tests-extra/tests/events/ddns/test.py2
-rw-r--r--tests-extra/tests/modules/stats/test.py2
-rw-r--r--tests-extra/tools/dnstest/knsupdate.py12
-rw-r--r--tests-extra/tools/dnstest/server.py6
-rw-r--r--tests-extra/tools/dnstest/test.py6
-rw-r--r--tests-extra/tools/dnstest/update.py15
9 files changed, 126 insertions, 127 deletions
diff --git a/tests-extra/tests/ddns/basic/test.py b/tests-extra/tests/ddns/basic/test.py
index 84be09adf..cb191a984 100644
--- a/tests-extra/tests/ddns/basic/test.py
+++ b/tests-extra/tests/ddns/basic/test.py
@@ -6,11 +6,7 @@ from dnstest.utils import *
from dnstest.test import Test
import random
-KNSUPDATE = random.choice([True, False])
-detail_log("Using knsupdate %s\n" % str(KNSUPDATE))
-PROTOS = [Proto.TCP, Proto.TLS] + ([Proto.QUIC] if KNSUPDATE else [])
-
-t = Test(tls=True, quic=True, knsupdate=KNSUPDATE)
+t = Test(tls=True, quic=True)
def check_soa(master, prev_soa):
soa_resp = master.dig("ddns.", "SOA")
@@ -22,12 +18,12 @@ def verify(master, zone, dnssec):
master.flush(wait=True)
master.zone_verify(zone)
-def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
+def do_normal_tests(master, zone, dnssec=False):
# add node
check_log("Node addition")
up = master.update(zone)
up.add("rrtest.ddns.", 3600, "A", "1.2.3.4")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
verify(master, zone, dnssec)
@@ -36,7 +32,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Node update - new record")
up = master.update(zone)
up.add("rrtest.ddns.", 3600, "A", "1.2.3.5")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
resp.check(rcode="NOERROR", rdata="1.2.3.5")
@@ -47,7 +43,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("rrtest.ddns.", 3600, "A", "1.2.3.7")
up.add("rrtest.ddns.", 3600, "A", "1.2.3.0")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.0")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
@@ -59,7 +55,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Node update - new rrset")
up = master.update(zone)
up.add("rrtest.ddns.", 3600, "TXT", "abcedf")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "TXT")
resp.check(rcode="NOERROR", rdata="abcedf")
resp = master.dig("rrtest.ddns.", "A")
@@ -73,7 +69,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Node update - rrset removal")
up = master.update(zone)
up.delete("rrtest.ddns.", "TXT")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "TXT")
resp.check(rcode="NOERROR")
compare(resp.count(section="answer"), 0, "TXT rrset removal")
@@ -88,7 +84,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Node update - record removal")
up = master.update(zone)
up.delete("rrtest.ddns.", "A", "1.2.3.5")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NOERROR", nordata="1.2.3.5")
resp.check(rcode="NOERROR", rdata="1.2.3.0")
@@ -101,7 +97,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("rrtest.ddns.", "A", "1.2.3.0")
up.delete("rrtest.ddns.", "A", "1.2.3.7")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NOERROR", nordata="1.2.3.0")
resp.check(rcode="NOERROR", nordata="1.2.3.7")
@@ -113,7 +109,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("rrtest.ddns.", "ANY")
up.add("rrtest.ddns.", 7, "A", "1.2.3.8")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.8")
verify(master, zone, dnssec)
@@ -122,7 +118,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Node removal")
up = master.update(zone)
up.delete("rrtest.ddns.", "ANY")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest.ddns.", "A")
resp.check(rcode="NXDOMAIN")
verify(master, zone, dnssec)
@@ -132,7 +128,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("deleg.ddns.", 3600, "NS", "a.deleg.ddns.")
up.add("a.deleg.ddns.", 3600, "A", "1.2.3.4")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleg.ddns.", "NS")
resp.check_record(section="authority", rtype="NS", rdata="a.deleg.ddns.")
resp.check_record(section="additional", rtype="A", rdata="1.2.3.4")
@@ -142,7 +138,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Delegation w/o glue")
up = master.update(zone)
up.add("deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleglue.ddns.", "NS")
resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.")
resp.check_no_rr(section="additional", rname="a.deleglue.ddns.", rtype="A")
@@ -152,7 +148,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Glue for existing delegation")
up = master.update(zone)
up.add("a.deleglue.ddns.", 3600, "A", "10.20.30.40")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleglue.ddns.", "NS")
resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.")
resp.check_record(section="additional", rtype="A", rdata="10.20.30.40")
@@ -162,7 +158,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Remove delegation, keep glue")
up = master.update(zone)
up.delete("deleglue.ddns.", "NS")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleglue.ddns.", "NS")
resp.check(rcode="NOERROR")
resp.check_record(section="authority", rtype="SOA")
@@ -176,7 +172,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Add delegation to existing glue")
up = master.update(zone)
up.add("deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleglue.ddns.", "NS")
resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.")
resp.check_record(section="additional", rtype="A", rdata="10.20.30.40")
@@ -187,7 +183,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("a.deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.")
up.delete("deleglue.ddns.", "NS", "a.deleglue.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("x.a.deleglue.ddns.", "A")
resp.check(rcode="NOERROR")
resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.")
@@ -199,7 +195,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("a.deleglue.ddns.", "NS", "a.deleglue.ddns.")
up.add("deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleglue.ddns.", "NS")
resp.check(rcode="NOERROR")
resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.")
@@ -210,7 +206,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("glueless SVCB")
up = master.update(zone)
up.add("svcb.ddns.", 3600, "SVCB", "0 target.svcb.svcbtarget.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_count(0, rtype="AAAA", section="additional")
@@ -220,7 +216,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("target.svcb.svcbtarget.ddns.", 3600, "AAAA", "1::2")
up.add("target.svcb.svcbtarget.ddns.", 3600, "SVCB", "2 . alpn=h2")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_count(1, rtype="AAAA", section="additional")
@@ -233,7 +229,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("target.svcb.svcbtarget.ddns.", "AAAA")
up.delete("target.svcb.svcbtarget.ddns.", "SVCB")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_count(0, rtype="AAAA", section="additional")
@@ -243,7 +239,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("SVCB wildcard glue")
up = master.update(zone)
up.add("*.svcbtarget.ddns.", 3600, "AAAA", "1::3")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_record(section="additional", name="*.svcbtarget.ddns.", rtype="AAAA", ttl=3600, rdata="1::3")
@@ -255,7 +251,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("SVCB shuffle")
up.delete("svcb.ddns.", "SVCB")
up.add("svcb.ddns.", 3600, "SVCB", "1 target.svcb.svcbtarget.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_record(section="additional", name="*.svcbtarget.ddns.", rtype="AAAA", ttl=3600, rdata="1::3")
@@ -267,7 +263,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Remove wildcard glue")
up = master.update(zone)
up.delete("*.svcbtarget.ddns.", "AAAA", "1::3")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
t.sleep(1) # wait for zone_update_cleanup to trigger lost glue
resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec)
resp.check(rcode="NOERROR")
@@ -276,13 +272,13 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
# now remove SVCB in order to make ldns-verify work
up = master.update(zone)
up.delete("svcb.ddns.", "SVCB")
- up.send(proto=proto)
+ up.send()
# Add double-wildcard MX
check_log("Double-wildcard MX")
up = master.update(zone)
up.add("double.wc.mx.ddns.", 3600, "MX", "1 a.*.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_count(1, rtype="MX", section="answer")
@@ -292,7 +288,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Double-wildcard glue")
up = master.update(zone)
up.add("*.*.ddns.", 3600, "AAAA", "3::5")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_count(1, rtype="MX", section="answer")
@@ -304,7 +300,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("double.wc.mx.ddns.", "MX")
up.add("double.wc.mx.ddns.", 3600, "MX", "2 a.*.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec)
resp.check(rcode="NOERROR")
resp.check_count(1, rtype="MX", section="answer")
@@ -315,7 +311,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Remove double-wildcard glue")
up = master.update(zone)
up.delete("*.*.ddns.", "AAAA")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
t.sleep(1) # wait for zone_update_cleanup to trigger lost glue
resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec)
resp.check(rcode="NOERROR")
@@ -326,7 +322,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Add CNAME to A node")
up = master.update(zone)
up.add("dns1.ddns.", "3600", "CNAME", "ignore.me.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("dns1.ddns.", "CNAME")
compare(resp.count(), 0, "Added CNAME when it shouldn't")
verify(master, zone, dnssec)
@@ -337,7 +333,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("rrtest2.ddns.", "3600", "MX", "10 something.ddns.")
up.add("rrtest2.ddns.", "3600", "CNAME", "ignore.me.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest2.ddns.", "ANY")
resp.check(rcode="NOERROR")
resp.check_record(rtype="MX", rdata="10 something.ddns.")
@@ -349,7 +345,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Add A to CNAME node")
up = master.update(zone)
up.add("cname.ddns.", "3600", "A", "1.2.3.4")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("cname.ddns.", "ANY")
resp.check(rcode="NOERROR")
resp.check_record(rtype="A", nordata="1.2.3.4")
@@ -361,7 +357,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("rrtest3.ddns.", "3600", "CNAME", "dont.ignore.me.ddns.")
up.add("rrtest3.ddns.", "3600", "TXT", "ignore")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest3.ddns.", "ANY")
resp.check(rcode="NOERROR")
resp.check_record(rtype="TXT", nordata="ignore")
@@ -372,7 +368,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("CNAME to CNAME addition")
up = master.update(zone)
up.add("cname.ddns.", 3600, "CNAME", "new-cname.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("cname.ddns.", "CNAME")
resp.check(rcode="NOERROR", rdata="new-cname.ddns.")
resp.check(rcode="NOERROR", nordata="mail.ddns.")
@@ -383,7 +379,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("rrtest4.ddns.", "3600", "CNAME", "ignore.me.ddns.")
up.add("rrtest4.ddns.", "3600", "CNAME", "dont.ignore.me.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("rrtest3.ddns.", "ANY")
resp.check(rcode="NOERROR")
resp.check_record(rtype="CNAME", rdata="dont.ignore.me.ddns.")
@@ -395,7 +391,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("ddns.", 3600, "SOA",
"dns1.ddns. hostmaster.ddns. 2011111213 10800 3600 1209600 7200")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "SOA")
resp.check(rcode="NOERROR",
rdata="dns1.ddns. hostmaster.ddns. 2011111213 10800 3600 1209600 7200")
@@ -409,7 +405,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
"dns1.ddns. hostmaster.ddns. 2012111213 10800 3600 1209600 7200")
up.delete("ddns.", "SOA",
"dns1.ddns. hostmaster.ddns. 2012111213 10800 3600 1209600 7200")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "SOA")
resp.check(rcode="NOERROR",
rdata="dns1.ddns. hostmaster.ddns. 2012111213 10800 3600 1209600 7200")
@@ -422,7 +418,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up.add("ddns.", 3600, "SOA",
"dns1.ddns. hostmaster.ddns. 2013111213 10800 3600 1209600 7200")
up.delete("ddns.", "SOA")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "SOA")
resp.check(rcode="NOERROR")
resp.check_record(rtype="SOA", rdata="dns1.ddns. hostmaster.ddns. 2013111213 10800 3600 1209600 7200")
@@ -433,7 +429,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("ddns.", 3600, "SOA",
"dns1.ddns. hostmaster.ddns. 2010111213 10800 3600 1209600 7200")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "SOA")
resp.check(rcode="NOERROR",
rdata="dns1.ddns. hostmaster.ddns. 2013111213 10800 3600 1209600 7200")
@@ -444,7 +440,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("ddns.", 1800, "SOA",
"dns1.ddns. hostmaster.ddns. 2014111213 10800 1800 1209600 7200")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "SOA")
resp.check(rcode="NOERROR",
rdata="dns1.ddns. hostmaster.ddns. 2014111213 10800 1800 1209600 7200")
@@ -455,7 +451,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("testaddrem.ddns.", 3600, "TXT", "record")
up.delete("testaddrem.ddns.", "TXT", "record")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("testaddrem.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
verify(master, zone, dnssec)
@@ -465,7 +461,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("testaddrem.ddns.", 3600, "TXT", "record")
up.delete("testaddrem.ddns.", "TXT")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("testaddrem.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
verify(master, zone, dnssec)
@@ -474,14 +470,14 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Remove non-existent record")
up = master.update(zone)
up.delete("testaddrem.ddns.", "TXT", "record")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
verify(master, zone, dnssec)
# remove NS from APEX (NS should stay)
check_log("Remove NS")
up = master.update(zone)
up.delete("ddns.", "NS")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR")
resp.check_record(rtype="NS", rdata="dns1.ddns.")
@@ -492,7 +488,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Remove all NS")
up = master.update(zone)
up.delete("ddns.", "ANY")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR")
resp.check_record(rtype="NS", rdata="dns1.ddns.")
@@ -507,7 +503,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("ddns.", "NS")
up.add("ddns.", 3600, "NS", "dns3.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR")
resp.check_record(rtype="NS", rdata="dns1.ddns.")
@@ -523,7 +519,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up.delete("ddns.", "NS", "dns2.ddns.")
up.delete("ddns.", "NS", "dns3.ddns.")
up.add("ddns.", 3600, "NS", "dns4.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR", nordata="dns1.ddns.")
resp.check(nordata="dns2.ddns.")
@@ -538,7 +534,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up.add("ddns.", 3600, "NS", "dns5.ddns.")
up.delete("ddns.", "NS", "dns3.ddns.")
up.delete("ddns.", "NS", "dns4.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR", nordata="dns3.ddns.")
resp.check(nordata="dns4.ddns.")
@@ -550,7 +546,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("ddns.", 3600, "NS", "dns1.ddns.")
up.delete("ddns.", "NS", "dns5.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR", nordata="dns5.ddns.")
resp.check_record(rtype="NS", rdata="dns1.ddns.")
@@ -561,7 +557,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("ddns.", "NS", "dns1.ddns.")
up.add("ddns.", 3600, "NS", "dns2.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR")
resp.check_record(rtype="NS", rdata="dns1.ddns.")
@@ -573,7 +569,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.delete("ddns.", "NS", "dns1.ddns.")
up.delete("ddns.", "NS", "dns2.ddns.")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check(rcode="NOERROR", nordata="dns1.ddns.")
resp.check_record(rtype="NS", rdata="dns2.ddns.")
@@ -584,7 +580,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("ddns.", 3600, "NS", "dns1.ddns.")
up.delete("ddns.", "NS")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "NS")
resp.check_record(rtype="NS", rdata="dns1.ddns.")
resp.check_record(rtype="NS", rdata="dns2.ddns.")
@@ -594,7 +590,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Add empty generic record")
up = master.update(zone)
up.add("empty.ddns.", 300, "TYPE999", "\\# 0")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("empty.ddns.", "TYPE999")
resp.check_record(rtype="TYPE999", rdata="\\# 0")
verify(master, zone, dnssec)
@@ -603,7 +599,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Add NAPTR record")
up = master.update(zone)
up.add("3.1.1.1.1.1.1.1.1.2.7.9.9.ddns.", 172800, "NAPTR", "1 1 \"u\" \"E2U+sip\" \"!^.*$!sip:123@freeswitch.org!\" .")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("3.1.1.1.1.1.1.1.1.2.7.9.9.ddns.", "NAPTR")
resp.check_record(rtype="NAPTR", rdata="1 1 \"u\" \"E2U+sip\" \"!^.*$!sip:123@freeswitch.org!\" .")
verify(master, zone, dnssec)
@@ -612,7 +608,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Add TXT into apex")
up = master.update(zone)
up.add("ddns.", 300, "TXT", "This is apeeex!")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("ddns.", "TXT")
resp.check_record(rtype="TXT", rdata="This is apeeex!")
verify(master, zone, dnssec)
@@ -623,7 +619,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("deleg.ddns.", 3600, "DS",
"54576 10 2 397E50C85EDE9CDE33F363A9E66FD1B216D788F8DD438A57A423A386869C8F06")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("deleg.ddns.", "NS", dnssec=True)
resp.check(rcode="NOERROR")
resp.check_record(section="authority", rtype="DS",
@@ -636,7 +632,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("glue augmentation")
up = master.update(zone)
up.add("a.deleg.ddns.", 3600, "AAAA", "1::2")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("xy.deleg.ddns.", "A", dnssec=True)
resp.check_rr(section="authority", rname="deleg.ddns.", rtype="NS")
resp.check_rr(section="authority", rname="deleg.ddns.", rtype="RRSIG")
@@ -644,7 +640,7 @@ def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP):
resp.check_no_rr(section="additional", rname="a.deleg.ddns.", rtype="RRSIG")
verify(master, zone, dnssec)
-def do_refusal_tests(master, zone, dnssec=False, proto=Proto.TCP):
+def do_refusal_tests(master, zone, dnssec=False):
# Store initial SOA
soa_resp = master.dig("ddns.", "SOA")
prev_soa = soa_resp.resp.answer
@@ -653,35 +649,35 @@ def do_refusal_tests(master, zone, dnssec=False, proto=Proto.TCP):
check_log("Out-of-zone data")
up = master.update(zone)
up.add("what.the.hell.am.i.doing.here.", "3600", "TXT", "I don't belong here")
- up.send("NOTZONE", proto)
+ up.send("NOTZONE")
check_soa(master, prev_soa)
# Remove 'all' SOA, ignore
check_log("Remove all SOA")
up = master.update(zone)
up.delete("ddns.", "SOA")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
check_soa(master, prev_soa)
# Remove specific SOA, ignore
check_log("Remove specific SOA")
up = master.update(zone)
up.delete("ddns.", "SOA", "dns1.ddns. hostmaster.ddns. 2011111213 10800 3600 1209600 7200")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
check_soa(master, prev_soa)
# Out-of-apex NSEC3PARAM
check_log("Out-of-apex NSEC3PARAM")
up = master.update(zone)
up.add("mx.ddns.", 3600, "NSEC3PARAM", "1 0 0 -")
- up.send("REFUSED", proto)
+ up.send("REFUSED")
check_soa(master, prev_soa)
# Added NSEC3PARAM
check_log("Added NSEC3PARAM")
up = master.update(zone)
up.add("ddns.", 3600, "NSEC3PARAM", "1 0 0 -")
- up.send("REFUSED" if master.dnssec(zone).nsec3 else "NOERROR", proto)
+ up.send("REFUSED" if master.dnssec(zone).nsec3 else "NOERROR")
resp = master.dig("ddns.", "NSEC3PARAM")
resp.check_count(1, "NSEC3PARAM")
if master.dnssec(zone).nsec3:
@@ -696,7 +692,7 @@ def do_refusal_tests(master, zone, dnssec=False, proto=Proto.TCP):
up = master.update(zone)
up.add("nonapex.ddns.", "3600", "DNSKEY",
"256 3 5 AwEAAbs0AlA6xWQn/lECfGt3S6TaeEmgJfEVVEMh06iNMNWMRHOfbqLF h3N52Ob7trmzlrzGlGLPnAZJvMB8lsFGC5CtaLUBD+4xCh5tl5QifZ+y o+MJvPGlVQI2cs7aMWV9CyFrRmuRcJaSZU2uBz9KFJ955UCq/WIy5KqS 7qaKLzzN")
- up.send("NOERROR", proto)
+ up.send("NOERROR")
resp = master.dig("nonapex.ddns.", "DNSKEY")
resp.check(rcode="NOERROR",
rdata="256 3 5 AwEAAbs0AlA6xWQn/lECfGt3S6TaeEmgJfEVVEMh06iNMNWMRHOfbqLF h3N52Ob7trmzlrzGlGLPnAZJvMB8lsFGC5CtaLUBD+4xCh5tl5QifZ+y o+MJvPGlVQI2cs7aMWV9CyFrRmuRcJaSZU2uBz9KFJ955UCq/WIy5KqS 7qaKLzzN")
@@ -719,21 +715,18 @@ master_nsec3.dnssec(zone).nsec3_opt_out = (random.random() < 0.5)
t.start()
# DNSSEC-less test
-proto = random.choice(PROTOS)
-check_log("============ Plain test (%s) ===========" % proto)
-do_normal_tests(master_plain, zone, proto=proto)
-do_refusal_tests(master_plain, zone, proto=proto)
+check_log("============ Plain test ===========")
+do_normal_tests(master_plain, zone)
+do_refusal_tests(master_plain, zone)
# DNSSEC with NSEC test
-proto = random.choice(PROTOS)
-check_log("============ NSEC test (%s) ============" % proto)
-do_normal_tests(master_nsec, zone, dnssec=True, proto=proto)
-do_refusal_tests(master_nsec, zone, dnssec=True, proto=proto)
+check_log("============ NSEC test ============")
+do_normal_tests(master_nsec, zone, dnssec=True)
+do_refusal_tests(master_nsec, zone, dnssec=True)
# DNSSEC with NSEC3 test
-proto = random.choice(PROTOS)
-check_log("============ NSEC3 test (%s) ===========" % proto)
-do_normal_tests(master_nsec3, zone, dnssec=True, proto=proto)
-do_refusal_tests(master_nsec3, zone, dnssec=True, proto=proto)
+check_log("============ NSEC3 test ===========")
+do_normal_tests(master_nsec3, zone, dnssec=True)
+do_refusal_tests(master_nsec3, zone, dnssec=True)
t.end()
diff --git a/tests-extra/tests/ddns/prereq/test.py b/tests-extra/tests/ddns/prereq/test.py
index 2202e004c..88659695c 100644
--- a/tests-extra/tests/ddns/prereq/test.py
+++ b/tests-extra/tests/ddns/prereq/test.py
@@ -6,14 +6,8 @@ from dnstest.utils import *
from dnstest.test import Test
import random
-KNSUPDATE = random.choice([True, False])
-PROTOS = [Proto.TCP, Proto.TLS] + ([Proto.QUIC] if KNSUPDATE else [])
-PROTO = random.choice(PROTOS)
-XDP = True if PROTO == Proto.TCP else False # QUIC has the same port as QUIC+XDP, which does not work with DDNS
-detail_log("Using knsupdate %s %s\n" % (str(KNSUPDATE), str(PROTO)))
-
-t = Test(tls=True, quic=True, knsupdate=KNSUPDATE)
-srv = t.server("knot", xdp_enable=XDP)
+t = Test(tls=True, quic=True)
+srv = t.server("knot")
zone = t.zone("ddns.", storage=".")
t.link(zone, srv, ddns=True)
@@ -26,7 +20,7 @@ t.start()
update = srv.update(zone)
update.prereq_yx("existing.ddns.")
update.add("1.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("1.ddns.", "TXT")
resp.check("text")
@@ -34,7 +28,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_yx("ddns.")
update.add("2.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("2.ddns.", "TXT")
resp.check("text")
@@ -42,7 +36,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_yx("nonexistent.ddns.")
update.add("3.ddns.", 1, "TXT", "text")
-update.send("NXDOMAIN", proto=PROTO)
+update.send("NXDOMAIN")
resp = srv.dig("3.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -50,7 +44,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("nonexistent.")
update.add("4.ddns.", 1, "TXT", "text")
-update.send("NOTZONE", proto=PROTO)
+update.send("NOTZONE")
resp = srv.dig("4.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -60,7 +54,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_nx("nonexistent.ddns.")
update.add("4.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("4.ddns.", "TXT")
resp.check("text")
@@ -68,7 +62,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_nx("existing.ddns.")
update.add("5.ddns.", 1, "TXT", "text")
-update.send("YXDOMAIN", proto=PROTO)
+update.send("YXDOMAIN")
resp = srv.dig("5.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -76,7 +70,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_nx("nonexistent.")
update.add("6.ddns.", 1, "TXT", "text")
-update.send("NOTZONE", proto=PROTO)
+update.send("NOTZONE")
resp = srv.dig("6.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -86,7 +80,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_nx("nonexistent.ddns.", "TYPE65535")
update.add("7.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("7.ddns.", "TXT")
resp.check("text")
@@ -94,7 +88,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_nx("existing.ddns.", "TYPE65535")
update.add("8.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("8.ddns.", "TXT")
resp.check("text")
@@ -102,7 +96,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_nx("existing.ddns.", "A")
update.add("9.ddns.", 1, "TXT", "text")
-update.send("YXRRSET", proto=PROTO)
+update.send("YXRRSET")
resp = srv.dig("9.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -110,7 +104,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_nx("nonexistent.", "TYPE65535")
update.add("10.ddns.", 1, "TXT", "text")
-update.send("NOTZONE", proto=PROTO)
+update.send("NOTZONE")
resp = srv.dig("10.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -118,7 +112,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_nx("a.wildcard.ddns.", "TYPE65535")
update.add("11.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("11.ddns.", "TXT")
resp.check("text")
@@ -126,7 +120,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_nx("a.wildcard.ddns.", "A")
update.add("12.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("12.ddns.", "TXT")
resp.check("text")
@@ -134,7 +128,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_nx("*.wildcard.ddns.", "A")
update.add("13.ddns.", 1, "TXT", "text")
-update.send("YXRRSET", proto=PROTO)
+update.send("YXRRSET")
resp = srv.dig("13.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -144,7 +138,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("nonexistent.ddns.", "TYPE65535")
update.add("13.ddns.", 1, "TXT", "text")
-update.send("NXRRSET", proto=PROTO)
+update.send("NXRRSET")
resp = srv.dig("13.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -152,7 +146,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("existing.ddns.", "TYPE65535")
update.add("14.ddns.", 1, "TXT", "text")
-update.send("NXRRSET", proto=PROTO)
+update.send("NXRRSET")
resp = srv.dig("14.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -160,7 +154,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("existing.ddns.", "A")
update.add("15.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("15.ddns.", "TXT")
resp.check("text")
@@ -168,7 +162,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_yx("existing.ddns.", "A", "1.2.3.4")
update.add("16.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("16.ddns.", "TXT")
resp.check("text")
@@ -176,7 +170,7 @@ resp.check("text")
update = srv.update(zone)
update.prereq_yx("existing.ddns.", "A", "1.2.3.255")
update.add("17.ddns.", 1, "TXT", "text")
-update.send("NXRRSET", proto=PROTO)
+update.send("NXRRSET")
resp = srv.dig("17.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -184,7 +178,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("nonexistent.", "TYPE65535")
update.add("18.ddns.", 1, "TXT", "text")
-update.send("NOTZONE", proto=PROTO)
+update.send("NOTZONE")
resp = srv.dig("18.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -192,7 +186,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("a.wildcard.ddns.", "TYPE65535")
update.add("19.ddns.", 1, "TXT", "text")
-update.send("NXRRSET", proto=PROTO)
+update.send("NXRRSET")
resp = srv.dig("19.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -200,7 +194,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("a.wildcard.ddns.", "A")
update.add("20.ddns.", 1, "TXT", "text")
-update.send("NXRRSET", proto=PROTO)
+update.send("NXRRSET")
resp = srv.dig("20.ddns.", "TXT")
resp.check(rcode="NXDOMAIN")
@@ -208,7 +202,7 @@ resp.check(rcode="NXDOMAIN")
update = srv.update(zone)
update.prereq_yx("*.wildcard.ddns.", "A")
update.add("21.ddns.", 1, "TXT", "text")
-update.send("NOERROR", proto=PROTO)
+update.send("NOERROR")
resp = srv.dig("21.ddns.", "TXT")
resp.check("text")
diff --git a/tests-extra/tests/dnssec/offline_ksk/test.py b/tests-extra/tests/dnssec/offline_ksk/test.py
index 9c2ddbefa..e8b08d685 100644
--- a/tests-extra/tests/dnssec/offline_ksk/test.py
+++ b/tests-extra/tests/dnssec/offline_ksk/test.py
@@ -103,6 +103,7 @@ def wait_for_dnskey_count(t, server, dnskey_count, timeout):
def zone_update(master, slave, zone, upd_master):
server = master if upd_master else slave
+ server.ctl("-f zone-flush", wait=True) # re-flush zone file so that it's suitable for generating radnom DDNS
server.random_ddns(zone[0], allow_empty=True)
def writef(filename, contents):
diff --git a/tests-extra/tests/events/ddns/test.py b/tests-extra/tests/events/ddns/test.py
index f43f990da..362fb85c4 100644
--- a/tests-extra/tests/events/ddns/test.py
+++ b/tests-extra/tests/events/ddns/test.py
@@ -31,7 +31,7 @@ def flood(server, zone):
rr = None
updates = []
for i in range(FLOOD_COUNT):
- update = server.update(zone)
+ update = server.update(zone, allow_knsupdate=False)
for j in range(UPDATE_SIZE):
rr = [randstr() + "." + zone[0].name, 3600, "TXT", randstr()]
update.add(*rr)
diff --git a/tests-extra/tests/modules/stats/test.py b/tests-extra/tests/modules/stats/test.py
index d4bbddf1b..58b9732b4 100644
--- a/tests-extra/tests/modules/stats/test.py
+++ b/tests-extra/tests/modules/stats/test.py
@@ -95,7 +95,7 @@ check_item(knot, "mod-stats", "request-protocol", 2, "tcp%s" % proto + xdp_str)
check_item(knot, "mod-stats", "request-protocol", 2, "tcp%s" % proto + xdp_str, zone=zones[0])
# Successful update.
-up = knot.update(zones[1])
+up = knot.update(zones[1], allow_knsupdate=False)
up.add(zones[1].name, "3600", "AAAA", "::1")
up.send("NOERROR")
ddns_query_size = up.query_size()
diff --git a/tests-extra/tools/dnstest/knsupdate.py b/tests-extra/tools/dnstest/knsupdate.py
index 24f4a461b..76ac10cde 100644
--- a/tests-extra/tools/dnstest/knsupdate.py
+++ b/tests-extra/tools/dnstest/knsupdate.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import dns
from re import search, findall
from subprocess import Popen, PIPE
@@ -14,6 +15,10 @@ class Knsupdate:
self.tsig = tsig
self.output = ""
+ @property
+ def origin(self):
+ return dns.name.Name(self.zone)
+
def add(self, owner, ttl, rtype, rdata):
self.output += f"update add {owner}"
if ttl:
@@ -69,10 +74,13 @@ class Knsupdate:
# Mandatory header
header = f"server {addr} {port}\n"
header += f"zone {self.zone}\n"
+ header += f"origin {self.zone}\n"
+ whole_cmd = header + self.output + "show\nsend\nanswer\nexit\n"
+ detail_log(whole_cmd)
# Run process
cmd = Popen(cmdline, stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
- (stdout, stderr) = cmd.communicate(header + self.output + "show\nsend\nanswer\nexit\n")
+ (stdout, stderr) = cmd.communicate(whole_cmd)
with open(Context().out_dir + "/knsupdate.out", "a") as outf:
outf.write(' '.join(cmdline))
@@ -87,7 +95,7 @@ class Knsupdate:
rcv_ercode = rcodes[1]
- if rcv_ercode != "SERVFAIL" and "reply verification" in stderr:
+ if rcv_ercode != "SERVFAIL" and rcv_ercode != "NOTAUTH" and "reply verification" in stderr:
raise Failed("TSIG issues in DDNS")
self.output = ""
diff --git a/tests-extra/tools/dnstest/server.py b/tests-extra/tools/dnstest/server.py
index c03e946fc..912f7f119 100644
--- a/tests-extra/tools/dnstest/server.py
+++ b/tests-extra/tools/dnstest/server.py
@@ -229,8 +229,6 @@ class Server(object):
self.binding_errors = 0
- self.knsupdate = False
-
def _check_socket(self, proto, port):
if self.addr.startswith("/"):
param = ""
@@ -865,12 +863,12 @@ class Server(object):
resp = self.dig("0-x-not-existing-x-0." + zone.name, "ANY", dnssec=True)
resp.check_nsec(nsec3=nsec3, nonsec=nonsec)
- def update(self, zone):
+ def update(self, zone, allow_knsupdate=True):
zone = zone_arg_check(zone)
key_params = self.tsig_test.key_params if self.tsig_test else dict()
- if self.knsupdate:
+ if allow_knsupdate and random.choice([False, True]):
return dnstest.update.Update(self, dnstest.knsupdate.Knsupdate(zone.name, self.tsig_test))
else:
return dnstest.update.Update(self, dns.update.Update(zone.name, **key_params))
diff --git a/tests-extra/tools/dnstest/test.py b/tests-extra/tools/dnstest/test.py
index 43d29f480..4144d196e 100644
--- a/tests-extra/tools/dnstest/test.py
+++ b/tests-extra/tools/dnstest/test.py
@@ -38,8 +38,7 @@ class Test(object):
rel_time = time.time()
start_time = 0
- def __init__(self, address=None, tsig=None, stress=True, quic=False, tls=False, \
- knsupdate=False):
+ def __init__(self, address=None, tsig=None, stress=True, quic=False, tls=False):
if not os.path.exists(Context().out_dir):
raise Exception("Output directory doesn't exist")
@@ -48,7 +47,6 @@ class Test(object):
self.zones_dir = self.out_dir + "/zones/"
self.quic = quic
self.tls = tls
- self.knsupdate = knsupdate
if address == 4 or address == 6:
self.addr = Test.LOCAL_ADDR_COMMON[address]
@@ -219,8 +217,6 @@ class Test(object):
if os.path.isfile(suppressions_file):
srv.valgrind.append("--suppressions=%s" % suppressions_file)
- srv.knsupdate = self.knsupdate
-
self.servers.add(srv)
return srv
diff --git a/tests-extra/tools/dnstest/update.py b/tests-extra/tools/dnstest/update.py
index f38680b84..60a9e4f10 100644
--- a/tests-extra/tools/dnstest/update.py
+++ b/tests-extra/tools/dnstest/update.py
@@ -2,6 +2,7 @@
import dns.query
import dns.update
+import random
import ssl
from dnstest.utils import *
@@ -27,13 +28,21 @@ class Update(object):
def prereq_nx(self, owner, *args):
self.upd.absent(owner, *args)
- def send(self, rcode="NOERROR", proto=Proto.TCP):
+ def send(self, rcode="NOERROR", proto=None):
if type(rcode) is not str and rcode is not None:
rc = dns.rcode.to_text(rcode)
else:
rc = rcode
- check_log("UPDATE")
+ if proto is None and self.server.tls_port and self.server.quic_port and not self.server.xdp_port:
+ if type(self.upd) is Knsupdate:
+ proto = random.choice([ Proto.TCP, Proto.TLS, Proto.QUIC ])
+ else:
+ proto = random.choice([ Proto.TCP, Proto.TLS ])
+ elif proto is None:
+ proto = Proto.TCP
+
+ check_log("UPDATE over %s using %s" % (proto, "knsupdate" if type(self.upd) is Knsupdate else "dnspython"))
detail_log(str(self.upd))
detail_log(SEP)
@@ -75,7 +84,7 @@ class Update(object):
detail_log(SEP)
if type(self.upd) is Knsupdate:
- rc = self.upd.send()
+ rc = self.upd.send(self.server.addr, self.server.port, Proto.TCP)
else:
resp = dns.query.tcp(self.upd, self.server.addr, port=self.server.port)
rc = dns.rcode.to_text(resp.rcode())