mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-23 10:37:43 -04:00
test views are detached before leaving exclusive mode
Adds a log-based test ensuring that when a reconfiguration fails inside the view configuration, the newly created view are always detached before the exclusive mode is ended.
This commit is contained in:
parent
d7dbfbb011
commit
47dd27d87b
2 changed files with 42 additions and 6 deletions
|
|
@ -11,7 +11,7 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
// NS2
|
||||
{% set wrongoption = wrongoption | default(False) %}
|
||||
|
||||
options {
|
||||
port @PORT@;
|
||||
|
|
@ -30,9 +30,15 @@ controls {
|
|||
inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
|
||||
zone "example." {
|
||||
type primary;
|
||||
file "example.db";
|
||||
view "default" {
|
||||
zone "example." {
|
||||
type primary;
|
||||
file "example.db";
|
||||
};
|
||||
/*
|
||||
* failure to reconfig must occurs during configuration of the views
|
||||
*/
|
||||
{% if wrongoption %}
|
||||
forwarders port 9999999 { 127.0.0.1; };
|
||||
{% endif %}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@
|
|||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import re
|
||||
|
||||
|
||||
import isctest
|
||||
|
||||
|
||||
def test_configloading_log(ns1):
|
||||
"""
|
||||
|
|
@ -39,3 +44,28 @@ def test_configloading_log(ns1):
|
|||
with ns1.watch_log_from_here() as watcher:
|
||||
ns1.rndc("reload")
|
||||
watcher.wait_for_sequence(log_sequence)
|
||||
|
||||
|
||||
def test_reload_fails_log(ns1, templates):
|
||||
"""
|
||||
This test ensures that when a reconfig fails during view configuration (or
|
||||
after), views/zones (which are newly created view/zones which won't be used
|
||||
and local of apply_configuration) are detached (and freed) before the
|
||||
exclusive mode is released
|
||||
"""
|
||||
|
||||
log_sequence = [
|
||||
"apply_configuration",
|
||||
"loop exclusive mode: starting",
|
||||
"apply_configuration: configure_views",
|
||||
re.compile(r".*port '9999999' out of range"),
|
||||
"apply_configuration: detaching views",
|
||||
"loop exclusive mode: ending",
|
||||
]
|
||||
|
||||
with ns1.watch_log_from_here() as watcher:
|
||||
templates.render("ns1/named.conf", {"wrongoption": True})
|
||||
try:
|
||||
ns1.rndc("reload")
|
||||
except isctest.rndc.RNDCException:
|
||||
watcher.wait_for_sequence(log_sequence)
|
||||
|
|
|
|||
Loading…
Reference in a new issue