diff --git a/tests-extra/tests/notify/notify/data/notify.zone b/tests-extra/tests/notify/notify/data/notify.zone new file mode 100644 index 0000000000000000000000000000000000000000..aac8cf66a453150865b7c71aa66251f2c1192b52 --- /dev/null +++ b/tests-extra/tests/notify/notify/data/notify.zone @@ -0,0 +1,17 @@ +$ORIGIN notify. +$TTL 3600 + +@ SOA dns1 hostmaster 2010111201 10800 3600 1209600 7200 + NS dns1 + NS dns2 + MX 10 mail + +dns1 A 192.0.2.1 + AAAA 2001:DB8::1 + +dns2 A 192.0.2.2 + AAAA 2001:DB8::2 + +mail A 192.0.2.3 + AAAA 2001:DB8::3 + diff --git a/tests-extra/tests/notify/notify/data/notify.zone.1 b/tests-extra/tests/notify/notify/data/notify.zone.1 new file mode 100644 index 0000000000000000000000000000000000000000..4d226725c10938f87886a50672a697e9876e08b8 --- /dev/null +++ b/tests-extra/tests/notify/notify/data/notify.zone.1 @@ -0,0 +1,18 @@ +$ORIGIN notify. +$TTL 3600 + +@ SOA dns1 hostmaster 2010111202 10800 3600 1209600 7200 + NS dns1 + NS dns2 + MX 10 mail + +dns1 A 192.0.2.1 + AAAA 2001:DB8::1 + +dns2 A 192.0.2.2 + AAAA 2001:DB8::2 + +mail A 192.0.2.3 + AAAA 2001:DB8::3 + +node A 1.2.3.4 diff --git a/tests-extra/tests/notify/notify/data/notify.zone.2 b/tests-extra/tests/notify/notify/data/notify.zone.2 new file mode 100644 index 0000000000000000000000000000000000000000..50715ccf9eeb8299b7bddf228cd58824ead3df6f --- /dev/null +++ b/tests-extra/tests/notify/notify/data/notify.zone.2 @@ -0,0 +1,18 @@ +$ORIGIN notify. +$TTL 3600 + +@ SOA dns1 hostmaster 2010111203 10800 3600 1209600 7200 + NS dns1 + NS dns2 + MX 10 mail + +dns1 A 192.0.2.1 + AAAA 2001:DB8::1 + +dns2 A 192.0.2.2 + AAAA 2001:DB8::2 + +mail A 192.0.2.3 + AAAA 2001:DB8::3 + +node A 1.2.3.4 diff --git a/tests-extra/tests/notify/notify/data/notify.zone.3 b/tests-extra/tests/notify/notify/data/notify.zone.3 new file mode 100644 index 0000000000000000000000000000000000000000..009a76b99cc572c00212f27d81125b0cd3eb5c62 --- /dev/null +++ b/tests-extra/tests/notify/notify/data/notify.zone.3 @@ -0,0 +1,19 @@ +$ORIGIN notify. +$TTL 3600 + +@ SOA dns1 hostmaster 2010111203 10800 3600 1209600 7200 + NS dns1 + NS dns2 + MX 10 mail + +dns1 A 192.0.2.1 + AAAA 2001:DB8::1 + +dns2 A 192.0.2.2 + AAAA 2001:DB8::2 + +mail A 192.0.2.3 + AAAA 2001:DB8::3 + +node A 1.2.3.4 +nonode A 1.2.3.5 diff --git a/tests-extra/tests/notify/notify/test.py b/tests-extra/tests/notify/notify/test.py new file mode 100644 index 0000000000000000000000000000000000000000..f239f9f2d52be2300fe1ae32f04a3a5087b5cbbb --- /dev/null +++ b/tests-extra/tests/notify/notify/test.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +'''Test for NOTIFY: if serial is different, slave shall update, otherwise not''' + +from dnstest.test import Test + +t = Test() + +master = t.server("knot") +slave = t.server("knot") + +zone = t.zone("notify.", storage=".") + +t.link(zone, master, slave) + +t.start() + +serial = master.zone_wait(zone) +slave.zone_wait(zone) + +master.update_zonefile(zone, version=1) +master.reload() + +serial = slave.zone_wait(zone, serial=serial, equal=False, greater=True) + +resp = slave.dig("node.notify.", "A") +resp.check(rcode="NOERROR", rdata="1.2.3.4") + +slave.update_zonefile(zone, version=2) +slave.reload() + +master.update_zonefile(zone, version=3) +master.reload() +# master now sends NOTIFY with SOA=2010111203 which shall slave ignore +t.sleep(2) + +resp = slave.dig("nonode.notify.", "A") +resp.check(rcode="NXDOMAIN", nordata="1.2.3.5") + +t.end()