Explorar o código

Add test for stop error when not in stoppable state

Mike Naberezny %!s(int64=11) %!d(string=hai) anos
pai
achega
f2866e3ae5
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      supervisor/tests/test_process.py

+ 16 - 0
supervisor/tests/test_process.py

@@ -661,6 +661,22 @@ class SubprocessTests(unittest.TestCase):
         self.assertEqual(instance.killing, 1)
         self.assertEqual(options.kills[11], signal.SIGTERM)
 
+    def test_stop_not_in_stoppable_state_error(self):
+        options = DummyOptions()
+        config = DummyPConfig(options, 'test', '/test')
+        instance = self._makeOne(config)
+        instance.pid = 11
+        dispatcher = DummyDispatcher(writable=True)
+        instance.dispatchers = {'foo':dispatcher}
+        from supervisor.states import ProcessStates
+        instance.state = ProcessStates.STOPPED
+        try:
+            instance.stop()
+            fail('nothing raised')
+        except AssertionError, exc:
+            self.assertEqual(exc.args[0], 'Assertion failed for test: '
+                'STOPPED not in RUNNING STARTING STOPPING')
+
     def test_give_up(self):
         options = DummyOptions()
         config = DummyPConfig(options, 'test', '/test')