BIND 10 trac2353, updated. 71cf0a22ba08d32908a610b749e9aefe1c4dda1a [2353] Test the env string in various tests
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Dec 5 05:45:40 UTC 2012
The branch, trac2353 has been updated
via 71cf0a22ba08d32908a610b749e9aefe1c4dda1a (commit)
via 40d54f7e2b04dc53be81a24e50f8e66be968e6cb (commit)
via 30e529ac56321e0654bf8bbe48412b851bd06bb9 (commit)
from f1035ba18d68d4a1fa89719a9dc8e5eb6ae24d84 (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 71cf0a22ba08d32908a610b749e9aefe1c4dda1a
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Dec 5 11:12:17 2012 +0530
[2353] Test the env string in various tests
commit 40d54f7e2b04dc53be81a24e50f8e66be968e6cb
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Dec 5 11:08:54 2012 +0530
[2353] Test the values of component registered by BoB.register_process()
commit 30e529ac56321e0654bf8bbe48412b851bd06bb9
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Dec 5 11:01:30 2012 +0530
[2353] Make test more deterministic
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/tests/bind10_test.py.in | 36 +++++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index f26052b..dd1fd24 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -759,6 +759,7 @@ class MockBobSimple(BoB):
# Set which process has been started
self.started_process_name = None
self.started_process_args = None
+ self.started_process_env = None
def _make_mock_process_info(self, name, args, c_channel_env,
dev_null_stdout=False, dev_null_stderr=False):
@@ -769,6 +770,7 @@ class MockBobSimple(BoB):
address=None):
self.started_process_name = name
self.started_process_args = args
+ self.started_process_env = c_channel_env
return None
class TestStartStopProcessesBob(unittest.TestCase):
@@ -1611,24 +1613,34 @@ class TestBossComponents(unittest.TestCase):
bob._make_process_info = bob._make_mock_process_info
global attempts
+ global tsec
attempts = 0
+ tsec = 0
tmp_time = time.time
+ tmp_sleep = time.sleep
def _my_time():
global attempts
+ global tsec
attempts += 1
- return tmp_time()
+ return tsec
+ def _my_sleep(nsec):
+ global tsec
+ tsec += nsec
time.time = _my_time
+ time.sleep = _my_sleep
with self.assertRaises(bind10_src.CChannelConnectError):
# An exception will be thrown here when it eventually times
# out.
pi = bob.start_msgq()
- # 1 second of attempts every 0.1 seconds should result in at
- # least 5 attempts
- self.assertGreater(attempts, 5)
+ # 1 second of attempts every 0.1 seconds should result in 10
+ # attempts. 1 attempt happens at the start. 2 more attempts seem
+ # to happen inside start_msgq().
+ self.assertEqual(attempts, 13)
time.time = tmp_time
+ time.sleep = tmp_sleep
def test_start_cfgmgr(self):
'''Test that b10-cfgmgr is started.'''
@@ -1781,6 +1793,9 @@ class TestBossComponents(unittest.TestCase):
self.assertFalse(53 in bob.components)
bob.register_process(53, component)
self.assertTrue(53 in bob.components)
+ self.assertEqual(bob.components[53].name(), 'test')
+ self.assertEqual(bob.components[53].pid(), 53)
+ self.assertEqual(bob.components[53].address(), 'Test')
def test_start_simple(self):
'''Test simple process startup.'''
@@ -1802,53 +1817,59 @@ class TestBossComponents(unittest.TestCase):
def test_start_auth(self):
'''Test that b10-auth is started.'''
bob = MockBobSimple()
- bob.c_channel_env = {}
+ bob.c_channel_env = {'FOO': 'an env string'}
# non-verbose case
bob.verbose = False
bob.start_auth()
self.assertEqual('b10-auth', bob.started_process_name)
self.assertEqual(['b10-auth'], bob.started_process_args)
+ self.assertEqual({'FOO': 'an env string'}, bob.started_process_env)
# verbose case
bob.verbose = True
bob.start_auth()
self.assertEqual('b10-auth', bob.started_process_name)
self.assertEqual(['b10-auth', '-v'], bob.started_process_args)
+ self.assertEqual({'FOO': 'an env string'}, bob.started_process_env)
def test_start_resolver(self):
'''Test that b10-resolver is started.'''
bob = MockBobSimple()
- bob.c_channel_env = {}
+ bob.c_channel_env = {'BAR': 'an env string'}
# non-verbose case
bob.verbose = False
bob.start_resolver()
self.assertEqual('b10-resolver', bob.started_process_name)
self.assertEqual(['b10-resolver'], bob.started_process_args)
+ self.assertEqual({'BAR': 'an env string'}, bob.started_process_env)
# verbose case
bob.verbose = True
bob.start_resolver()
self.assertEqual('b10-resolver', bob.started_process_name)
self.assertEqual(['b10-resolver', '-v'], bob.started_process_args)
+ self.assertEqual({'BAR': 'an env string'}, bob.started_process_env)
def test_start_cmdctl(self):
'''Test that b10-cmdctl is started.'''
bob = MockBobSimple()
- bob.c_channel_env = {}
+ bob.c_channel_env = {'BAZ': 'an env string'}
# non-verbose case
bob.verbose = False
bob.start_cmdctl()
self.assertEqual('b10-cmdctl', bob.started_process_name)
self.assertEqual(['b10-cmdctl'], bob.started_process_args)
+ self.assertEqual({'BAZ': 'an env string'}, bob.started_process_env)
# verbose case
bob.verbose = True
bob.start_cmdctl()
self.assertEqual('b10-cmdctl', bob.started_process_name)
self.assertEqual(['b10-cmdctl', '-v'], bob.started_process_args)
+ self.assertEqual({'BAZ': 'an env string'}, bob.started_process_env)
# with port
bob.verbose = True
@@ -1856,6 +1877,7 @@ class TestBossComponents(unittest.TestCase):
bob.start_cmdctl()
self.assertEqual('b10-cmdctl', bob.started_process_name)
self.assertEqual(['b10-cmdctl', '--port=9353', '-v'], bob.started_process_args)
+ self.assertEqual({'BAZ': 'an env string'}, bob.started_process_env)
def test_socket_data(self):
'''Test that BoB._socket_data works as expected.'''
More information about the bind10-changes
mailing list