BIND 10 trac2353, updated. bc4926dac23a819a909992abf58df64d62647c68 [2353] Test BoB.startup()

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Nov 19 22:23:28 UTC 2012


The branch, trac2353 has been updated
       via  bc4926dac23a819a909992abf58df64d62647c68 (commit)
      from  fa3e24bb027671b5c53a5fa1b004920cf8252f0f (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 bc4926dac23a819a909992abf58df64d62647c68
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Nov 20 03:52:55 2012 +0530

    [2353] Test BoB.startup()

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

Summary of changes:
 src/bin/bind10/tests/bind10_test.py.in |   36 ++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 8672e52..833ea15 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1904,6 +1904,42 @@ class TestBossComponents(unittest.TestCase):
         self.assertEqual(len(bob._unix_sockets), 1)
         self.assertEqual(bob._unix_sockets[42][1], b'You')
 
+    def test_startup(self):
+        '''Test that BoB.startup() handles failures properly.'''
+        class MockBobStartup(BoB):
+            def __init__(self, throw):
+                self.throw = throw
+                self.started = False
+                self.killed = False
+                self.msgq_socket_file = None
+                self.curproc = 'myproc'
+                self.runnable = False
+
+            def start_all_components(self):
+                self.started = True
+                if self.throw:
+                    raise Exception('Assume starting components has failed.')
+
+            def kill_started_components(self):
+                self.killed = True
+
+        # All is well case
+        bob = MockBobStartup(False)
+        r = bob.startup()
+        self.assertIsNone(r)
+        self.assertTrue(bob.started)
+        self.assertFalse(bob.killed)
+        self.assertTrue(bob.runnable)
+
+        # Case where starting all components fails
+        bob = MockBobStartup(True)
+        r = bob.startup()
+        # r contains an error message
+        self.assertEqual(r, 'Unable to start myproc: Assume starting components has failed.')
+        self.assertTrue(bob.started)
+        self.assertTrue(bob.killed)
+        self.assertFalse(bob.runnable)
+
 class SocketSrvTest(unittest.TestCase):
     """
     This tests some methods of boss related to the unix domain sockets used



More information about the bind10-changes mailing list