BIND 10 trac2353, updated. 0740a5d8df7f65518b2b87662b4375630e1838ef [2353] Check an environment string in BoB.start_msgq() test

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Nov 29 02:45:11 UTC 2012


The branch, trac2353 has been updated
       via  0740a5d8df7f65518b2b87662b4375630e1838ef (commit)
       via  045d32e4a9f14e7deec58e5e7d55867a34325764 (commit)
       via  eba06eeedde4091fed26761f696a2aab5535074a (commit)
       via  93d27cba1a47182b5f94e45b5d569386f2a1ad25 (commit)
       via  8a966b8d7359a852478e380e89e94cfe2f12d5bd (commit)
       via  2c2459fd09fd1fb9b2c741eca0b93a8550f3f9b3 (commit)
       via  145a4ed5a89c92d93303604ceff83ec3d17ff87d (commit)
      from  41ccdad87bfc96af06dd83ecd143e4277795eb5f (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 0740a5d8df7f65518b2b87662b4375630e1838ef
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 08:14:18 2012 +0530

    [2353] Check an environment string in BoB.start_msgq() test

commit 045d32e4a9f14e7deec58e5e7d55867a34325764
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 08:11:51 2012 +0530

    [2353] Check BoB.get_processes() return value as a list

commit eba06eeedde4091fed26761f696a2aab5535074a
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 08:05:33 2012 +0530

    [2353] Use assertIn() in some places

commit 93d27cba1a47182b5f94e45b5d569386f2a1ad25
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 08:02:39 2012 +0530

    [2353] Check BoB.components_to_restart as a list

commit 8a966b8d7359a852478e380e89e94cfe2f12d5bd
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 07:58:15 2012 +0530

    [2353] Update syntax used, combining two statements into one

commit 2c2459fd09fd1fb9b2c741eca0b93a8550f3f9b3
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 07:57:16 2012 +0530

    [2353] Rewrite code that depended on BoB.start_ccsession() returning a value

commit 145a4ed5a89c92d93303604ceff83ec3d17ff87d
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 29 07:52:37 2012 +0530

    [2353] Don't run block of code when requested not to by unittests

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

Summary of changes:
 src/bin/bind10/bind10_src.py.in        |   25 +++++++++++----------
 src/bin/bind10/tests/bind10_test.py.in |   37 ++++++++++++++++----------------
 2 files changed, 30 insertions(+), 32 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index f0a9d6b..592dc3f 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -474,19 +474,20 @@ class BoB:
         bind_cfgd.spawn()
         self.log_started(bind_cfgd.pid)
 
-        # Wait for the configuration manager to start up as subsequent initialization
-        # cannot proceed without it.  The time to wait can be set on the command line.
-        time_remaining = self.wait_time
-        msg, env = self.cc_session.group_recvmsg()
-        while time_remaining > 0 and not self.process_running(msg, "ConfigManager"):
-            logger.debug(DBG_PROCESS, BIND10_WAIT_CFGMGR)
-            time.sleep(1)
-            time_remaining = time_remaining - 1
+        if not self.run_under_unittests:
+            # Wait for the configuration manager to start up as
+            # subsequent initialization cannot proceed without it.  The
+            # time to wait can be set on the command line.
+            time_remaining = self.wait_time
             msg, env = self.cc_session.group_recvmsg()
+            while time_remaining > 0 and not self.process_running(msg, "ConfigManager"):
+                logger.debug(DBG_PROCESS, BIND10_WAIT_CFGMGR)
+                time.sleep(1)
+                time_remaining = time_remaining - 1
+                msg, env = self.cc_session.group_recvmsg()
         
-        if not self.process_running(msg, "ConfigManager") and \
-                not self.run_under_unittests:
-            raise ProcessStartError("Configuration manager process has not started")
+            if not self.process_running(msg, "ConfigManager"):
+                raise ProcessStartError("Configuration manager process has not started")
 
         return bind_cfgd
 
@@ -508,8 +509,6 @@ class BoB:
         self.ccs.start()
         logger.debug(DBG_PROCESS, BIND10_STARTED_CC)
 
-        return self.ccs
-
     # A couple of utility methods for starting processes...
 
     def start_process(self, name, args, c_channel_env, port=None, address=None):
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index bc40426..e4bf192 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1446,21 +1446,20 @@ class TestBossComponents(unittest.TestCase):
         bob._component_configurator._components['test'] = (None, component)
         self.__setup_restart(bob, component)
         self.assertTrue(component.restarted)
-        self.assertFalse(component in bob.components_to_restart)
+        self.assertNotIn(component, bob.components_to_restart)
 
         # Remove the component from the configuration.  It won't be restarted
         # even if scheduled, nor will remain in the to-be-restarted list.
         del bob._component_configurator._components['test']
         self.__setup_restart(bob, component)
         self.assertFalse(component.restarted)
-        self.assertFalse(component in bob.components_to_restart)
+        self.assertNotIn(component, bob.components_to_restart)
 
     def test_get_processes(self):
         '''Test that procsses are returned correctly, sorted by pid.'''
         bob = MockBob()
 
-        pids = []
-        pids.extend(range(0, 20))
+        pids = list(range(0, 20))
         random.shuffle(pids)
 
         for i in range(0, 20):
@@ -1492,14 +1491,14 @@ class TestBossComponents(unittest.TestCase):
         component.has_failed = failed
         bob.components[53] = component
 
-        self.assertFalse(component in bob.components_to_restart)
+        self.assertNotIn(component, bob.components_to_restart)
 
         bob.reap_children()
 
         if runnable and is_running and not failed:
-            self.assertTrue(bob.components_to_restart)
+            self.assertIn(component, bob.components_to_restart)
         else:
-            self.assertFalse(bob.components_to_restart)
+            self.assertEqual([], bob.components_to_restart)
 
     def test_reap_children(self):
         '''Test that children are queued to be restarted when they ask for it.'''
@@ -1527,7 +1526,7 @@ class TestBossComponents(unittest.TestCase):
         bob.components_to_restart = []
         # this should do nothing as the pid is unknown
         bob.reap_children()
-        self.assertFalse(bob.components_to_restart)
+        self.assertEqual([], bob.components_to_restart)
 
         # case where bob._get_process_exit_status() raises OSError with
         # errno.ECHILD
@@ -1536,7 +1535,7 @@ class TestBossComponents(unittest.TestCase):
         bob.components_to_restart = []
         # this should catch and handle the OSError
         bob.reap_children()
-        self.assertFalse(bob.components_to_restart)
+        self.assertEqual([], bob.components_to_restart)
 
         # case where bob._get_process_exit_status() raises OSError with
         # errno other than ECHILD
@@ -1561,13 +1560,13 @@ class TestBossComponents(unittest.TestCase):
 
         self.assertEqual([[53, 'test', 'Test']], bob.get_processes())
         bob.kill_started_components()
-        self.assertFalse(bob.get_processes())
+        self.assertEqual([], bob.get_processes())
         self.assertTrue(component.forceful)
 
     def test_start_msgq(self):
         '''Test that b10-msgq is started.'''
         bob = MockBobSimple()
-        bob.c_channel_env = {}
+        bob.c_channel_env = {'FOO': 'an env string'}
         bob.run_under_unittests = True
 
         # use the MockProcessInfo creator
@@ -1580,7 +1579,7 @@ class TestBossComponents(unittest.TestCase):
         self.assertEqual(['b10-msgq'], pi.args)
         self.assertTrue(pi.dev_null_stdout)
         self.assertTrue(pi.dev_null_stderr)
-        self.assertEqual({}, pi.env)
+        self.assertEqual({'FOO': 'an env string'}, pi.env)
 
         # this is set by ProcessInfo.spawn()
         self.assertEqual(42147, pi.pid)
@@ -1592,7 +1591,7 @@ class TestBossComponents(unittest.TestCase):
         self.assertEqual(['b10-msgq'], pi.args)
         self.assertTrue(pi.dev_null_stdout)
         self.assertFalse(pi.dev_null_stderr)
-        self.assertEqual({}, pi.env)
+        self.assertEqual({'FOO': 'an env string'}, pi.env)
 
         # this is set by ProcessInfo.spawn()
         self.assertEqual(42147, pi.pid)
@@ -1755,12 +1754,12 @@ class TestBossComponents(unittest.TestCase):
         tmp = isc.config.ModuleCCSession
         isc.config.ModuleCCSession = DummySession
 
-        ccs = bob.start_ccsession({})
-        self.assertEqual(bind10_src.SPECFILE_LOCATION, ccs.specfile)
-        self.assertEqual(bob.config_handler, ccs.config_handler)
-        self.assertEqual(bob.command_handler, ccs.command_handler)
-        self.assertEqual(bob.msgq_socket_file, ccs.socket_file)
-        self.assertTrue(ccs.started)
+        bob.start_ccsession({})
+        self.assertEqual(bind10_src.SPECFILE_LOCATION, bob.ccs.specfile)
+        self.assertEqual(bob.config_handler, bob.ccs.config_handler)
+        self.assertEqual(bob.command_handler, bob.ccs.command_handler)
+        self.assertEqual(bob.msgq_socket_file, bob.ccs.socket_file)
+        self.assertTrue(bob.ccs.started)
 
         isc.config.ModuleCCSession = tmp
 



More information about the bind10-changes mailing list