xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/database/tests_database.py (revision 9689912e6b171cbda866ec33f15ae94a04e2c02d)
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
12import isctest
13
14import dns.message
15
16
17def test_database(servers, templates):
18    msg = dns.message.make_query("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    servers["ns1"].rndc("reload")
32
33    # checking post reload zone
34    res = isctest.query.tcp(msg, "10.53.0.1")
35    assert res.answer[0] == dns.rrset.from_text(
36        "database.",
37        86400,
38        "IN",
39        "SOA",
40        "localhost. marka.isc.org. 0 28800 7200 604800 86400",
41    )
42