Browse Source

[2353] Add test for BoB.kill_started_components()

Mukund Sivaraman 12 years ago
parent
commit
71739287e4
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/bin/bind10/tests/bind10_test.py.in

+ 14 - 0
src/bin/bind10/tests/bind10_test.py.in

@@ -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