tests_database.py revision 1.1.1.3 1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2 #
3 # SPDX-License-Identifier: MPL-2.0
4 #
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
8 #
9 # See the COPYRIGHT file distributed with this work for additional
10 # information regarding copyright ownership.
11
12 import dns
13
14 import isctest
15
16
17 def test_database(ns1, templates):
18 msg = isctest.query.create("database.", "SOA")
19
20 # checking pre reload zone
21 res = isctest.query.tcp(msg, "10.53.0.1")
22 assert res.answer[0] == dns.rrset.from_text(
23 "database.",
24 86400,
25 "IN",
26 "SOA",
27 "localhost. hostmaster.isc.org. 0 28800 7200 604800 86400",
28 )
29
30 templates.render("ns1/named.conf", {"rname": "marka.isc.org."})
31 with ns1.watch_log_from_here() as watcher:
32 ns1.rndc("reload")
33 watcher.wait_for_line("all zones loaded")
34
35 # checking post reload zone
36 res = isctest.query.tcp(msg, "10.53.0.1")
37 assert res.answer[0] == dns.rrset.from_text(
38 "database.",
39 86400,
40 "IN",
41 "SOA",
42 "localhost. marka.isc.org. 0 28800 7200 604800 86400",
43 )
44