]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2353] Add test for BoB.kill_started_components()
authorMukund Sivaraman <muks@isc.org>
Tue, 6 Nov 2012 07:36:36 +0000 (13:06 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 6 Nov 2012 07:36:36 +0000 (13:06 +0530)
src/bin/bind10/tests/bind10_test.py.in

index 3ab8bffa8a1fa6f2ecc0ba002aa5f5452eb5b641..8a0c60756181c0f4c4a4d5ef6daed1e38117f410 100644 (file)
@@ -951,6 +951,9 @@ class MockComponent:
     def failed(self, status):
         return False
 
+    def kill(self, status):
+        return
+
 class TestBossCmd(unittest.TestCase):
     def test_ping(self):
         """
@@ -1370,6 +1373,17 @@ class TestBossComponents(unittest.TestCase):
         # now, we should as the mock component.failed() returns False
         self.assertTrue(component in bob.components_to_restart)
 
+    def test_kill_started_components(self):
+        '''Test that started components are killed.'''
+        bob = MockBob()
+        bob.runnable = True
+        component = MockComponent('test', 53, 'Test')
+        bob.components[53] = component
+
+        self.assertEqual([[53, 'test', 'Test']], bob.get_processes())
+        bob.kill_started_components()
+        self.assertEqual([], bob.get_processes())
+
 class SocketSrvTest(unittest.TestCase):
     """
     This tests some methods of boss related to the unix domain sockets used