BIND 10 trac2353, updated. e8a23d31110a2824368bff0c41f79016d696f613 [2353] Remove run_under_unittests hack from BoB.start_cfgmgr()
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Dec 6 03:02:36 UTC 2012
The branch, trac2353 has been updated
via e8a23d31110a2824368bff0c41f79016d696f613 (commit)
via f7e301237c7806b582172fcf80a892659a3d9e32 (commit)
from 4f806512c8b2a99f3b1dc43fda7130ec81d21c1f (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 e8a23d31110a2824368bff0c41f79016d696f613
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Dec 6 08:32:06 2012 +0530
[2353] Remove run_under_unittests hack from BoB.start_cfgmgr()
commit f7e301237c7806b582172fcf80a892659a3d9e32
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Dec 6 08:30:54 2012 +0530
[2353] Make DummySession() return a real message in group_recvmsg()
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10_src.py.in | 23 +++++++++++------------
src/bin/bind10/tests/bind10_test.py.in | 25 +++++++++++++++++++++++--
2 files changed, 34 insertions(+), 14 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 592dc3f..00bdb92 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -474,20 +474,19 @@ class BoB:
bind_cfgd.spawn()
self.log_started(bind_cfgd.pid)
- 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
+ # 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()
- 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"):
- 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
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 1723d33..25bd9a8 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1649,16 +1649,33 @@ class TestBossComponents(unittest.TestCase):
def test_start_cfgmgr(self):
'''Test that b10-cfgmgr is started.'''
class DummySession():
+ def __init__(self):
+ self._tries = 0
def group_recvmsg(self):
- return (None, None)
+ self._tries += 1
+ # return running on the 3rd try onwards
+ if self._tries >= 3:
+ return ({'running': 'ConfigManager'}, None)
+ else:
+ return ({}, None)
+
bob = MockBobSimple()
bob.c_channel_env = {}
bob.cc_session = DummySession()
- bob.run_under_unittests = True
+ bob.run_under_unittests = False
+ bob.wait_time = 5
# use the MockProcessInfo creator
bob._make_process_info = bob._make_mock_process_info
+ global attempts
+ attempts = 0
+ self._tmp_sleep = time.sleep
+ def _my_sleep(nsec):
+ global attempts
+ attempts += 1
+ time.sleep = _my_sleep
+
# defaults
pi = bob.start_cfgmgr()
self.assertEqual('b10-cfgmgr', pi.name)
@@ -1668,6 +1685,10 @@ class TestBossComponents(unittest.TestCase):
# this is set by ProcessInfo.spawn()
self.assertEqual(42147, pi.pid)
+ # check that 2 attempts were made. on the 3rd attempt,
+ # process_running() returns that ConfigManager is running.
+ self.assertEqual(attempts, 2)
+
# data_path is specified
bob.data_path = '/var/lib/test'
pi = bob.start_cfgmgr()
More information about the bind10-changes
mailing list