BIND 10 trac2353, updated. 3e2d8b00ba86773f3cba03f935e5847cee109f84 [2353] Update comments (recommended by review)

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Dec 10 01:18:22 UTC 2012


The branch, trac2353 has been updated
       via  3e2d8b00ba86773f3cba03f935e5847cee109f84 (commit)
       via  32011f9a367b479a983dbb32e877590b18fbc275 (commit)
      from  02f306c854846cf972886c8f42e1b6e642c89e4a (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 3e2d8b00ba86773f3cba03f935e5847cee109f84
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Dec 10 06:47:56 2012 +0530

    [2353] Update comments (recommended by review)

commit 32011f9a367b479a983dbb32e877590b18fbc275
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Dec 10 06:43:07 2012 +0530

    [2353] Rename and document BoB._run_under_unittests

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

Summary of changes:
 src/bin/bind10/bind10_src.py.in        |    8 ++++++--
 src/bin/bind10/tests/bind10_test.py.in |   22 ++++++++++++++--------
 2 files changed, 20 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 00bdb92..e626d79 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -217,7 +217,11 @@ class BoB:
         self.cmdctl_port = cmdctl_port
         self.wait_time = wait_time
         self.msgq_timeout = 5
-        self.run_under_unittests = False
+
+        # _run_under_unittests is only meant to be used when testing. It
+        # bypasses execution of some code to help with testing.
+        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
@@ -437,7 +441,7 @@ class BoB:
         cc_connect_start = time.time()
         while self.cc_session is None:
             # if we are run under unittests, break
-            if self.run_under_unittests:
+            if self._run_under_unittests:
                 break
 
             # if we have been trying for "a while" give up
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 917e133..409790c 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1595,7 +1595,7 @@ class TestBossComponents(unittest.TestCase):
         '''Test that b10-msgq is started.'''
         bob = MockBobSimple()
         bob.c_channel_env = {'FOO': 'an env string'}
-        bob.run_under_unittests = True
+        bob._run_under_unittests = True
 
         # use the MockProcessInfo creator
         bob._make_process_info = bob._make_mock_process_info
@@ -1611,9 +1611,10 @@ class TestBossComponents(unittest.TestCase):
         and times out eventually.'''
         bob = MockBobSimple()
         bob.c_channel_env = {}
-        # keep the timeout small for the test to complete quickly
+        # set the timeout to an arbitrary pre-determined value (which
+        # code below depends on)
         bob.msgq_timeout = 1
-        bob.run_under_unittests = False
+        bob._run_under_unittests = False
 
         # use the MockProcessInfo creator
         bob._make_process_info = bob._make_mock_process_info
@@ -1651,9 +1652,10 @@ class TestBossComponents(unittest.TestCase):
             # out.
             pi = bob.start_msgq()
 
-        # 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().
+        # time.time() should be called 12 times within the while loop:
+        # starting from 0, and 11 more times from 0.1 to 1.1. There's
+        # another call to time.time() outside the loop, which makes it
+        # 13.
         self.assertEqual(attempts, 13)
 
         # group_subscribe() should not have been called here.
@@ -1765,7 +1767,8 @@ 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
+        # set wait_time to an arbitrary pre-determined value (which code
+        # below depends on)
         bob.wait_time = 2
 
         # use the MockProcessInfo creator
@@ -1959,7 +1962,10 @@ class TestBossComponents(unittest.TestCase):
                 if flags != socket.MSG_DONTWAIT:
                     raise Exception('flags != socket.MSG_DONTWAIT')
                 # after 15 recv()s, throw a socket.error with EAGAIN to
-                # get _socket_data() to save back what's been read.
+                # get _socket_data() to save back what's been read. The
+                # number 15 is arbitrarily chosen, but the checks then
+                # depend on this being 15, i.e., if you adjust this
+                # number, you may have to adjust the checks below too.
                 if self.throw and self.i > 15:
                     raise socket.error(errno.EAGAIN, 'Try again')
                 if self.i >= len(self.buf):



More information about the bind10-changes mailing list