BIND 10 trac2353, updated. 41ccdad87bfc96af06dd83ecd143e4277795eb5f [2353] Use a flag instead of overriding BoB.wait_time
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Nov 29 02:11:07 UTC 2012
The branch, trac2353 has been updated
via 41ccdad87bfc96af06dd83ecd143e4277795eb5f (commit)
via 8682cdcb920f12df639aaa0e7720afb9b03bf849 (commit)
via 0688fdb85ded658b2ecf5aceb6e4691cb921ddfb (commit)
from cfdfb58ce442816cce069453d4051cc008691b74 (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 41ccdad87bfc96af06dd83ecd143e4277795eb5f
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Nov 29 07:40:51 2012 +0530
[2353] Use a flag instead of overriding BoB.wait_time
commit 8682cdcb920f12df639aaa0e7720afb9b03bf849
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Nov 29 07:12:10 2012 +0530
[2353] Add description for BoB._make_process_info()
commit 0688fdb85ded658b2ecf5aceb6e4691cb921ddfb
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Nov 29 06:54:34 2012 +0530
[2353] Use a flag instead of overriding BoB.msgq_timeout
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10_src.py.in | 14 +++++++++-----
src/bin/bind10/tests/bind10_test.py.in | 11 +++++++++--
2 files changed, 18 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index aa92c5d..f0a9d6b 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -217,6 +217,7 @@ class BoB:
self.cmdctl_port = cmdctl_port
self.wait_time = wait_time
self.msgq_timeout = 5
+ self.run_under_unittests = False
self._component_configurator = isc.bind10.component.Configurator(self,
isc.bind10.special_component.get_specials())
# The priorities here make them start in the correct order. First
@@ -415,6 +416,10 @@ class BoB:
def _make_process_info(self, name, args, env,
dev_null_stdout=False, dev_null_stderr=False):
+ """
+ Wrapper around ProcessInfo(), useful to override
+ ProcessInfo() creation during testing.
+ """
return ProcessInfo(name, args, env, dev_null_stdout, dev_null_stderr)
def start_msgq(self):
@@ -431,8 +436,8 @@ class BoB:
# Now connect to the c-channel
cc_connect_start = time.time()
while self.cc_session is None:
- # this is only used by unittests
- if self.msgq_timeout == 0:
+ # if we are run under unittests, break
+ if self.run_under_unittests:
break
# if we have been trying for "a while" give up
@@ -479,9 +484,8 @@ class BoB:
time_remaining = time_remaining - 1
msg, env = self.cc_session.group_recvmsg()
- # wait_time is set to 0 only by unittests
- if self.wait_time > 0 and not self.process_running(msg,
- "ConfigManager"):
+ if not self.process_running(msg, "ConfigManager") and \
+ not self.run_under_unittests:
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 ed7f14a..bc40426 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1568,7 +1568,7 @@ class TestBossComponents(unittest.TestCase):
'''Test that b10-msgq is started.'''
bob = MockBobSimple()
bob.c_channel_env = {}
- bob.msgq_timeout = 0
+ bob.run_under_unittests = True
# use the MockProcessInfo creator
bob._make_process_info = bob._make_mock_process_info
@@ -1604,6 +1604,9 @@ class TestBossComponents(unittest.TestCase):
bob.c_channel_env = {}
# keep the timeout small for the test to complete quickly
bob.msgq_timeout = 1
+ # specifically set this to False so that the connect is
+ # attempted
+ bob.run_under_unittests = False
# use the MockProcessInfo creator
bob._make_process_info = bob._make_mock_process_info
@@ -1641,7 +1644,7 @@ class TestBossComponents(unittest.TestCase):
bob = MockBobSimple()
bob.c_channel_env = {}
bob.cc_session = DummySession()
- bob.wait_time = 0
+ bob.run_under_unittests = True
# use the MockProcessInfo creator
bob._make_process_info = bob._make_mock_process_info
@@ -1703,7 +1706,11 @@ class TestBossComponents(unittest.TestCase):
bob = MockBobSimple()
bob.c_channel_env = {}
bob.cc_session = DummySession()
+ # keep the wait time small for the test to complete quickly
bob.wait_time = 2
+ # specifically set this to False so that the process check is
+ # attempted
+ bob.run_under_unittests = False
# use the MockProcessInfo creator
bob._make_process_info = bob._make_mock_process_info
More information about the bind10-changes
mailing list