Browse Source

[213] Document strange behaivour and test

Michal 'vorner' Vaner 13 years ago
parent
commit
7db8a3e327
2 changed files with 20 additions and 0 deletions
  1. 7 0
      src/bin/bind10/bind10_src.py.in
  2. 13 0
      src/bin/bind10/tests/bind10_test.py.in

+ 7 - 0
src/bin/bind10/bind10_src.py.in

@@ -623,6 +623,13 @@ class BoB:
         """
         Stop the Boss instance from a components' request. The exitcode
         indicates the desired exit code.
+
+        If we did not start yet, it raises an exception, which is meant
+        to propagate through the component and configurator to the startup
+        routine and abort the startup imediatelly. If it is started up already,
+        we just mark it so we terminate soon.
+
+        It does set the exit code in both cases.
         """
         if self.__stopping:
             return

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

@@ -341,6 +341,19 @@ class TestBossComponents(unittest.TestCase):
 
         bob._component_configurator.shutdown = orig
 
+    def test_component_shutdown(self):
+        """
+        Test the component_shutdown sets all variables accordingly.
+        """
+        bob = MockBob()
+        self.assertRaises(Exception, bob.component_shutdown, 1)
+        self.assertEqual(1, bob.exitcode)
+        bob._BoB__started = True
+        bob.runnable = True
+        bob.component_shutdown(2)
+        self.assertEqual(2, bob.exitcode)
+        self.assertFalse(bob.runnable)
+
     def test_init_config(self):
         """
         Test initial configuration is loaded.