Skip to content
Snippets Groups Projects
Commit 938f0f7f authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

tests-extra: added tests for zone serial changes

covered:
- data change, serial increase
- data change, serial doesn't change
- data change, serial < initial serial
parent 0f657232
Branches
Tags
No related merge requests found
$ORIGIN serial.
$TTL 3600
@ SOA dns1 hostmaster 2010111213 10800 3600 1209600 7200
NS dns1
NS dns2
dns1 A 192.0.2.1
AAAA 2001:DB8::1
dns2 A 192.0.2.2
AAAA 2001:DB8::2
new-record0 A 1.2.3.4 ; RR tagging the zone version (independent on serial)
$ORIGIN serial.
$TTL 3600
@ SOA dns1 hostmaster 2010111214 10800 3600 1209600 7200
NS dns1
NS dns2
dns1 A 192.0.2.1
AAAA 2001:DB8::1
dns2 A 192.0.2.2
AAAA 2001:DB8::2
new-record1 A 1.2.3.4 ; RR tagging the zone version (independent on serial)
$ORIGIN serial.
$TTL 3600
@ SOA dns1 hostmaster 2010111214 10800 3600 1209600 7200
NS dns1
NS dns2
dns1 A 192.0.2.1
AAAA 2001:DB8::1
dns2 A 192.0.2.2
AAAA 2001:DB8::2
new-record2 A 1.2.3.4 ; RR tagging the zone version (independent on serial)
$ORIGIN serial.
$TTL 3600
@ SOA dns1 hostmaster 2010111212 10800 3600 1209600 7200
NS dns1
NS dns2
dns1 A 192.0.2.1
AAAA 2001:DB8::1
dns2 A 192.0.2.2
AAAA 2001:DB8::2
new-record3 A 1.2.3.4 ; RR tagging the zone version (independent on serial)
$ORIGIN serial.
$TTL 3600
@ SOA dns1 hostmaster 2010111212 10800 3600 1209600 7200
NS dns1
NS dns2
dns1 A 192.0.2.1
AAAA 2001:DB8::1
dns2 A 192.0.2.2
AAAA 2001:DB8::2
new-record4 A 1.2.3.4 ; RR tagging the zone version (independent on serial)
#!/usr/bin/env python3
'''Test for reload of a changed zone (serial up, nochange, serial down). '''
from dnstest.test import Test
from dnstest.utils import set_err, detail_log
t = Test()
master = t.server("knot")
# Zone setup
zone = t.zone("serial.", storage = ".")
t.link(zone, master, ixfr = True)
t.start()
# Load zones
serial = master.zone_wait(zone)
def reload_zone(serial, version):
master.update_zonefile(zone, version)
master.reload()
new_serial = master.zone_wait(zone)
if new_serial != serial:
set_err("SOA MISMATCH")
detail_log("!Zone '%s' SOA serial %s != %s" % (zone[0].name, new_serial, serial))
return new_serial
resp = master.dig("version%d.%s" % (version, zone[0].name), "A", flags="RD")
resp.check(rcode="NOERROR", flags="AA")
# Zone changes, serial increases (create changeset)
version = 1
serial = serial + 1
reload_zone(serial, version)
# Zone changes, serial doesn't change (no new changeset)
version += 1
reload_zone(serial, version)
# Zone changes, serial jumps out-of-range (journal is not applicable)
version += 1
serial = serial - 2
reload_zone(serial, version)
# Stop master.
master.stop()
t.end()
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