ソースを参照

Make sure we can kill from the STOPPING state.

Chris McDonough 18 年 前
コミット
db3ba4261d
1 ファイル変更18 行追加0 行削除
  1. 18 0
      src/supervisor/tests/test_process.py

+ 18 - 0
src/supervisor/tests/test_process.py

@@ -591,6 +591,24 @@ class SubprocessTests(unittest.TestCase):
         self.assertEqual(options.kills[11], signal.SIGTERM)
         self.assertEqual(L[0].__class__, events.StoppingFromRunningEvent)
 
+    def test_kill_from_stopping(self):
+        options = DummyOptions()
+        config = DummyPConfig(options, 'test', '/test')
+        instance = self._makeOne(config)
+        instance.pid = 11
+        L = []
+        from supervisor.states import ProcessStates
+        from supervisor import events
+        events.subscribe(events.StoppingFromStartingEvent,lambda x: L.append(x))
+        from supervisor.process import ProcessStates
+        instance.state = ProcessStates.STOPPING
+        instance.kill(signal.SIGKILL)
+        self.assertEqual(options.logger.data[0], 'killing test (pid 11) with '
+                         'signal SIGKILL')
+        self.assertEqual(instance.killing, 1)
+        self.assertEqual(options.kills[11], signal.SIGKILL)
+        self.assertEqual(L, []) # no event because we didn't change state
+
     def test_finish(self):
         options = DummyOptions()
         config = DummyPConfig(options, 'notthere', '/notthere',