def test_signal_no_pid_no_kill(self, mock_kill, mock_killpg): usf = UserScriptForker() usf.children[1] = UserScriptChild(data={'nodect':512, 'args':[], 'cwd':'/dev/null', 'location':'foo', 'jobid':2, 'executable':'bar', 'user':'******', 'size':512, 'attrs':{'nopgkill': True}}) usf.signal(1, "SIGTERM") mock_kill.assert_not_called() mock_killpg.assert_not_called()
def test_signal_nokillpg(self, mock_kill, mock_killpg): #use kill if appropriate attr set. usf = UserScriptForker() usf.children[1] = UserScriptChild(data={'nodect':512, 'args':[], 'cwd':'/dev/null', 'location':'foo', 'jobid':2, 'executable':'bar', 'user':'******', 'size':512, 'attrs':{'nopgkill': True}}) usf.children[1].pid = 1234 usf.signal(1, "SIGTERM") mock_kill.assert_called_with(1234, 15) mock_killpg.assert_not_called()
def test_signal_pgroup(self, mock_kill, mock_killpg): #send a killpg to a script process group usf = UserScriptForker() usf.children[1] = UserScriptChild(data={'nodect':512, 'args':[], 'cwd':'/dev/null', 'location':'foo', 'jobid':2, 'executable':'bar', 'user':'******', 'size':512}) usf.children[1].pid = 1234 usf.signal(1, "SIGTERM") mock_killpg.assert_called_with(1234, 15) mock_kill.assert_not_called()
def test_signal_pgroup(self, mock_kill, mock_killpg): #send a killpg to a script process group usf = UserScriptForker() usf.children[1] = UserScriptChild( data={ 'nodect': 512, 'args': [], 'cwd': '/dev/null', 'location': 'foo', 'jobid': 2, 'executable': 'bar', 'user': '******', 'size': 512 }) usf.children[1].pid = 1234 usf.signal(1, "SIGTERM") mock_killpg.assert_called_with(1234, 15) mock_kill.assert_not_called()
def test_signal_no_pid_no_kill(self, mock_kill, mock_killpg): usf = UserScriptForker() usf.children[1] = UserScriptChild( data={ 'nodect': 512, 'args': [], 'cwd': '/dev/null', 'location': 'foo', 'jobid': 2, 'executable': 'bar', 'user': '******', 'size': 512, 'attrs': { 'nopgkill': True } }) usf.signal(1, "SIGTERM") mock_kill.assert_not_called() mock_killpg.assert_not_called()
def test_signal_nokillpg(self, mock_kill, mock_killpg): #use kill if appropriate attr set. usf = UserScriptForker() usf.children[1] = UserScriptChild( data={ 'nodect': 512, 'args': [], 'cwd': '/dev/null', 'location': 'foo', 'jobid': 2, 'executable': 'bar', 'user': '******', 'size': 512, 'attrs': { 'nopgkill': True } }) usf.children[1].pid = 1234 usf.signal(1, "SIGTERM") mock_kill.assert_called_with(1234, 15) mock_killpg.assert_not_called()