BIND 10 trac565, updated. 34d182ec09a5674e87470772cce024d49043cbd9 [trac565] Naming and wording fixes

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Feb 23 14:13:38 UTC 2011


The branch, trac565 has been updated
       via  34d182ec09a5674e87470772cce024d49043cbd9 (commit)
       via  f9e5f363f3abf3c08d65ff14421491b44ccbe8af (commit)
      from  841627853b192480a8e663870ad3a1cb39bb724e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 34d182ec09a5674e87470772cce024d49043cbd9
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Feb 23 10:32:01 2011 +0100

    [trac565] Naming and wording fixes

commit f9e5f363f3abf3c08d65ff14421491b44ccbe8af
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Feb 23 10:30:09 2011 +0100

    [trac565] Move common test code into a function
    
    Checking if correct processes run can be done by specifying boolean
    variables.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/bind10/bind10.py.in         |    4 +-
 src/bin/bind10/tests/bind10_test.py |  106 +++++++++++++---------------------
 2 files changed, 43 insertions(+), 67 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10.py.in b/src/bin/bind10/bind10.py.in
index 36a8006..221ed83 100644
--- a/src/bin/bind10/bind10.py.in
+++ b/src/bin/bind10/bind10.py.in
@@ -229,7 +229,7 @@ class BoB:
         self.verbose = verbose
 
     def config_handler(self, new_config):
-        # This is initial update, don't do anything by it, leave it to startup
+        # If this is initial update, don't do anything now, leave it to startup
         if not self.runnable:
             return
         if self.verbose:
@@ -605,7 +605,7 @@ class BoB:
     def stop_process(self, process, sendto):
         """
         Stop the given process, friendly-like. The process is the name it has
-        (in logs, etc), the second is the address on msgq.
+        (in logs, etc), the sento is the address on msgq.
         """
         if self.verbose:
             sys.stdout.write("[bind10] Asking %s to terminate\n" % process)
diff --git a/src/bin/bind10/tests/bind10_test.py b/src/bin/bind10/tests/bind10_test.py
index 17b78b1..392748c 100644
--- a/src/bin/bind10/tests/bind10_test.py
+++ b/src/bin/bind10/tests/bind10_test.py
@@ -142,13 +142,13 @@ class TestBoB(unittest.TestCase):
         self.assertEqual(bob.cfg_start_auth, True)
         self.assertEqual(bob.cfg_start_resolver, False)
 
-# Class for testing the Bob.start_all_processes() method call.
+# Class for testing the BoB start/stop components routines.
 #
 # Although testing that external processes start is outside the scope
 # of the unit test, by overriding the process start methods we can check
 # that the right processes are started depending on the configuration
 # options.
-class StartAllProcessesBob(BoB):
+class StartCheckBob(BoB):
     def __init__(self):
         BoB.__init__(self)
 
@@ -199,6 +199,9 @@ class StartAllProcessesBob(BoB):
     def start_cmdctl(self, c_channel_env):
         self.cmdctl = True
 
+    # We don't really use all of these stop_ methods. But it might turn out
+    # someone would add some stop_ method to BoB and we want that one overriden
+    # in case he forgets to update the tests.
     def stop_msgq(self):
         self.msgq = False
 
@@ -235,85 +238,58 @@ class TestStartStopProcessesBob(unittest.TestCase):
     of processes and that the right processes are started and stopped
     according to changes in configuration.
     """
+    def check_started(self, bob, core, auth, resolver):
+        """
+        Check that the right sets of processes are started. The ones that
+        should running are specified by the core, auth and resolver parameters
+        (they are groups of processes, eg. auth means b10-auth, -xfrout, -xfrin
+        and -zonemgr).
+        """
+        self.assertEqual(bob.msgq, core)
+        self.assertEqual(bob.cfgmgr, core)
+        self.assertEqual(bob.ccsession, core)
+        self.assertEqual(bob.auth, auth)
+        self.assertEqual(bob.resolver, resolver)
+        self.assertEqual(bob.xfrout, auth)
+        self.assertEqual(bob.xfrin, auth)
+        self.assertEqual(bob.zonemgr, auth)
+        self.assertEqual(bob.stats, core)
+        self.assertEqual(bob.cmdctl, core)
+
     def check_preconditions(self, bob):
-        self.assertEqual(bob.msgq, False)
-        self.assertEqual(bob.cfgmgr, False)
-        self.assertEqual(bob.ccsession, False)
-        self.assertEqual(bob.auth, False)
-        self.assertEqual(bob.resolver, False)
-        self.assertEqual(bob.xfrout, False)
-        self.assertEqual(bob.xfrin, False)
-        self.assertEqual(bob.zonemgr, False)
-        self.assertEqual(bob.stats, False)
-        self.assertEqual(bob.cmdctl, False)
+        self.check_started(self, bob, False, False, False)
 
     def check_started_none(self, bob):
         """
         Check that the situation is according to configuration where no servers
         should be started. Some processes still need to be running.
         """
-        self.assertEqual(bob.msgq, True)
-        self.assertEqual(bob.cfgmgr, True)
-        self.assertEqual(bob.ccsession, True)
-        self.assertEqual(bob.auth, False)
-        self.assertEqual(bob.resolver, False)
-        self.assertEqual(bob.xfrout, False)
-        self.assertEqual(bob.xfrin, False)
-        self.assertEqual(bob.zonemgr, False)
-        self.assertEqual(bob.stats, True)
-        self.assertEqual(bob.cmdctl, True)
+        self.check_started(self, bob, True, False, False)
 
     def check_started_both(self, bob):
         """
         Check the situation is according to configuration where both servers
         (auth and resolver) are enabled.
         """
-        self.assertEqual(bob.msgq, True)
-        self.assertEqual(bob.cfgmgr, True)
-        self.assertEqual(bob.ccsession, True)
-        self.assertEqual(bob.auth, True)
-        self.assertEqual(bob.resolver, True)
-        self.assertEqual(bob.xfrout, True)
-        self.assertEqual(bob.xfrin, True)
-        self.assertEqual(bob.zonemgr, True)
-        self.assertEqual(bob.stats, True)
-        self.assertEqual(bob.cmdctl, True)
+        self.check_started(self, bob, True, True, True)
 
     def check_started_auth(self, bob):
         """
         Check the set of processes needed to run auth only is started.
         """
-        self.assertEqual(bob.msgq, True)
-        self.assertEqual(bob.cfgmgr, True)
-        self.assertEqual(bob.ccsession, True)
-        self.assertEqual(bob.auth, True)
-        self.assertEqual(bob.resolver, False)
-        self.assertEqual(bob.xfrout, True)
-        self.assertEqual(bob.xfrin, True)
-        self.assertEqual(bob.zonemgr, True)
-        self.assertEqual(bob.stats, True)
-        self.assertEqual(bob.cmdctl, True)
+        self.check_started(self, bob, True, True, False)
 
     def check_started_resolver(self, bob):
         """
         Check the set of processes needed to run resolver only is started.
         """
-        self.assertEqual(bob.msgq, True)
-        self.assertEqual(bob.cfgmgr, True)
-        self.assertEqual(bob.ccsession, True)
-        self.assertEqual(bob.auth, False)
-        self.assertEqual(bob.resolver, True)
-        self.assertEqual(bob.xfrout, False)
-        self.assertEqual(bob.xfrin, False)
-        self.assertEqual(bob.zonemgr, False)
-        self.assertEqual(bob.stats, True)
-        self.assertEqual(bob.cmdctl, True)
+        self.check_started(self, bob, True, False, True)
 
     # Checks the processes started when starting neither auth nor resolver
     # is specified.
     def test_start_none(self):
-        # Created Bob and ensure initialization correct
-        bob = StartAllProcessesBob()
+        # Create BoB and ensure correct initialization
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         # Start processes and check what was started
@@ -325,8 +301,8 @@ class TestStartStopProcessesBob(unittest.TestCase):
 
     # Checks the processes started when starting only the auth process
     def test_start_auth(self):
-        # Created Bob and ensure initialization correct
-        bob = StartAllProcessesBob()
+        # Create BoB and ensure correct initialization
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         # Start processes and check what was started
@@ -339,8 +315,8 @@ class TestStartStopProcessesBob(unittest.TestCase):
 
     # Checks the processes started when starting only the resolver process
     def test_start_resolver(self):
-        # Created Bob and ensure initialization correct
-        bob = StartAllProcessesBob()
+        # Create BoB and ensure correct initialization
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         # Start processes and check what was started
@@ -353,8 +329,8 @@ class TestStartStopProcessesBob(unittest.TestCase):
 
     # Checks the processes started when starting both auth and resolver process
     def test_start_both(self):
-        # Created Bob and ensure initialization correct
-        bob = StartAllProcessesBob()
+        # Create BoB and ensure correct initialization
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         # Start processes and check what was started
@@ -371,8 +347,8 @@ class TestStartStopProcessesBob(unittest.TestCase):
         to configuration changes.
         """
 
-        # Created Bob and ensure initialization correct
-        bob = StartAllProcessesBob()
+        # Create BoB and ensure correct initialization
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         # Start processes (nothing much should be started, as in
@@ -436,8 +412,8 @@ class TestStartStopProcessesBob(unittest.TestCase):
         """
         Tests that a process is started only once.
         """
-        # Created Bob and ensure initialization correct
-        bob = StartAllProcessesBob()
+        # Create BoB and ensure correct initialization
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         # Start processes (both)
@@ -463,7 +439,7 @@ class TestStartStopProcessesBob(unittest.TestCase):
         Test that processes are not started by the config handler before
         startup.
         """
-        bob = StartAllProcessesBob()
+        bob = StartCheckBob()
         self.check_preconditions(bob)
 
         bob.start_auth = lambda: self.fail("Started auth again")




More information about the bind10-changes mailing list