]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add reconfiguration support to NamedInstance
authorMichał Kępień <michal@isc.org>
Tue, 25 Jul 2023 12:37:05 +0000 (14:37 +0200)
committerŠtěpán Balážik <stepan@isc.org>
Thu, 21 Dec 2023 18:10:15 +0000 (18:10 +0000)
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?)

bin/tests/system/isctest/instance.py

index ac0fceec0114cc093f615ca5d0df6e2ce74e264a..fdac94c7d2fd0f7ba3237cee7718ff66cc453225 100644 (file)
@@ -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