Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
'''Test of Knot behavior when master has older SOA'''
from dnstest.test import Test
EXPIRE_SLEEP = 13
RESYNC_SLEEP = 5
TEST_START_EXPECTED = 3
t = Test()
master = t.server("knot")
slave = t.server("knot")
# this zone has refresh = 5s, retry = 5s and expire = 13s
zone = t.zone("example.", storage=".")
t.link(zone, master, slave)
master.disable_notify = True
slave.disable_notify = True
t.start()
# initial convenience check
master.zone_wait(zone)
slave.zone_wait(zone)
resp = slave.dig("added.example.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
# check that slave ignored outdated master
master.update_zonefile(zone, version=1)
master.stop()
master.start()
t.sleep(RESYNC_SLEEP - TEST_START_EXPECTED)
resp = master.dig("added.example.", "A")
resp.check(rcode="NXDOMAIN")
resp = slave.dig("added.example.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
# check that slave bootstrapped older zone
t.sleep(EXPIRE_SLEEP - RESYNC_SLEEP)
resp = slave.dig("added.example.", "A")
resp.check(rcode="NXDOMAIN")
t.stop()