Skip to content

Commit

Permalink
TESTS: exception handling while spawning fcgi-program which address a…
Browse files Browse the repository at this point in the history
…lready bound to another process
  • Loading branch information
cod1k committed Jan 27, 2023
1 parent a7cb60d commit 8d697b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion supervisor/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from supervisor.tests.base import DummyProcessGroup
from supervisor.tests.base import DummyFCGIProcessGroup

from supervisor.process import Subprocess
from supervisor.process import Subprocess, ProcessStates
from supervisor.options import BadCommand

class SubprocessTests(unittest.TestCase):
Expand Down Expand Up @@ -1799,6 +1799,14 @@ def test_before_spawn_gets_socket_ref(self):
instance.before_spawn()
self.assertFalse(instance.fcgi_sock is None)

def test_before_spawn_failure_sets_fatal_state(self):
options = DummyOptions()
config = DummyPConfig(options, 'good', '/good/filename', uid=1)
instance = self._makeOne(config)
self.assertEqual(instance.state, ProcessStates.STOPPED)
instance.spawn()
self.assertEqual(instance.state, ProcessStates.FATAL)

def test_after_finish_removes_socket_ref(self):
options = DummyOptions()
config = DummyPConfig(options, 'good', '/good/filename', uid=1)
Expand Down

0 comments on commit 8d697b3

Please sign in to comment.