From 77b611be7c83d4fdf8d3fa9e2e1e65044947e947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Tue, 25 Jul 2023 14:37:05 +0200 Subject: [PATCH] Add reconfiguration support to NamedInstance Reconfiguring named using RNDC is a common action in BIND 9 system tests. It involves sending the "reconfig" RNDC command to a named instance and waiting until it is fully processed. Add a reconfigure() method to the NamedInstance class in order to simplify and standardize named reconfiguration using RNDC in Python-based system tests. TODO: - full reconfiguration support (w/templating *.in files) - add an "rndc null" before every reconfiguration to show which file is used (NamedInstance.add_mark_to_log() as it may be generically useful?) (cherry picked from commit fdc45c70e84817849540f31581f5d0fe039a957f) --- bin/tests/system/isctest/instance.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/tests/system/isctest/instance.py b/bin/tests/system/isctest/instance.py index ac0fceec01..fdac94c7d2 100644 --- a/bin/tests/system/isctest/instance.py +++ b/bin/tests/system/isctest/instance.py @@ -142,6 +142,15 @@ class NamedInstance: """ return WatchLogFromHere(self._log_file) + def reconfigure(self) -> None: + """ + Reconfigure this named `instance` and wait until reconfiguration is + finished. Raise an `RNDCException` if reconfiguration fails. + """ + with self.watch_log_from_here() as watcher: + self.rndc("reconfig") + watcher.wait_for_line("any newly configured zones are now loaded") + def _rndc_log(self, command: str, response: str) -> None: """ Log an `rndc` invocation (and its output) to the `rndc.log` file in the