Commit f9e76c02 authored by Libor Peltan's avatar Libor Peltan

tests: add test for zonefile-flush: 0

parent a9a22344
#!/usr/bin/env python3
'''With zonefile-flush: 0, test that the zonefile gets flushed immediately in various scenarios'''
from dnstest.test import Test
from dnstest.utils import *
t = Test()
master = t.server("knot")
slave = t.server("knot")
zone = t.zone_rnd(1, dnssec=False, records=100)
t.link(zone, master, slave)
master.dnssec(zone).enable = True
master.zonefile_sync = 0
slave.zonefile_sync = 0
t.start()
m_zfpath = master.zones[zone[0].name].zfile.path
s_zfpath = slave.zones[zone[0].name].zfile.path
master.zones_wait(zone)
slave.zones_wait(zone)
t.sleep(2)
# check zonefile flushed after load and sign
master.zone_verify(zone)
# check zonefile flushed after AXFR
slave.zone_verify(zone)
m_mtime1 = os.stat(m_zfpath).st_mtime
s_mtime1 = os.stat(s_zfpath).st_mtime
up = master.update(zone)
up.add("djojdw", 3600, "TXT", "this wont sure be there yet")
up.send("NOERROR")
t.sleep(2)
m_mtime2 = os.stat(m_zfpath).st_mtime
s_mtime2 = os.stat(s_zfpath).st_mtime
# check zonefile flushed after DDNS
if m_mtime2 == m_mtime1:
set_err("Not flushed after DDNS")
# check zonefile flushed after IXFR
if s_mtime2 == s_mtime1:
set_err("Not flushed after IXFR")
t.end()
Markdown is supported
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