BIND 10 trac2353, updated. 996d6ff3b0e79c723332d03296cbbe88b552d373 [2353] Test BoB.start_cfgmgr() timeout checks

BIND 10 source code commits bind10-changes at lists.isc.org
Sun Nov 18 23:17:49 UTC 2012


The branch, trac2353 has been updated
       via  996d6ff3b0e79c723332d03296cbbe88b552d373 (commit)
       via  924c7a481efc5aa34c8bc73efb395c2c80282cc0 (commit)
       via  8cb9e9efb9cd47301e6784840142931631e1664f (commit)
      from  f117a66b8be41e88a18a27bd7b2f1275b624767a (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 996d6ff3b0e79c723332d03296cbbe88b552d373
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Nov 19 04:47:32 2012 +0530

    [2353] Test BoB.start_cfgmgr() timeout checks

commit 924c7a481efc5aa34c8bc73efb395c2c80282cc0
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Nov 19 04:46:58 2012 +0530

    [2353] Restore the saved time.time function

commit 8cb9e9efb9cd47301e6784840142931631e1664f
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Nov 19 04:46:31 2012 +0530

    [2353] Don't check an upper bound on number of attempts

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

Summary of changes:
 src/bin/bind10/tests/bind10_test.py.in |   43 ++++++++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 6410476..a111cbc 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1620,9 +1620,10 @@ class TestBossComponents(unittest.TestCase):
         # We just check that an exception was thrown, and that several
         # attempts were made to connect.
         self.assertTrue(thrown)
-        # 1 second of attempts every 0.1 seconds should result in at least 5 attempts, but less than 15
+        # 1 second of attempts every 0.1 seconds should result in at least 5 attempts
         self.assertGreater(attempts, 5)
-        self.assertLess(attempts, 15)
+
+        time.time = tmp_time
 
     def test_start_cfgmgr(self):
         '''Test that b10-cfgmgr is started.'''
@@ -1685,6 +1686,44 @@ class TestBossComponents(unittest.TestCase):
         # this is set by ProcessInfo.spawn()
         self.assertEqual(42147, pi.pid)
 
+    def test_start_cfgmgr_timeout(self):
+        '''Test that b10-cfgmgr startup attempts connections several times
+        and times out eventually.'''
+        class DummySession():
+            def group_recvmsg(self):
+                return (None, None)
+        bob = MockBobSimple()
+        bob.c_channel_env = {}
+        bob.cc_session = DummySession()
+        bob.wait_time = 2
+
+        # use the MockProcessInfo creator
+        bob._make_process_info = bob._make_mock_process_info
+
+        global attempts
+        attempts = 0
+        tmp_sleep = time.sleep
+        def _my_sleep(nsec):
+            global attempts
+            attempts += 1
+            return tmp_sleep(nsec)
+        time.sleep = _my_sleep
+
+        thrown = False
+        # An exception will be thrown here when it eventually times out.
+        try:
+            pi = bob.start_cfgmgr()
+        except bind10_src.ProcessStartError as e:
+            thrown = True
+
+        # We just check that an exception was thrown, and that several
+        # attempts were made to connect.
+        self.assertTrue(thrown)
+        # 2 seconds of attempts every 1 second should result in 2 attempts
+        self.assertEqual(attempts, 2)
+
+        time.sleep = tmp_sleep
+
     def test_start_ccsession(self):
         '''Test that CC session is started.'''
         class DummySession():



More information about the bind10-changes mailing list