コード例 #1
0
ファイル: test_forkers.py プロジェクト: ido/cobalt
 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()
コード例 #2
0
ファイル: test_forkers.py プロジェクト: ido/cobalt
 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()
コード例 #3
0
ファイル: test_forkers.py プロジェクト: ido/cobalt
 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()
コード例 #4
0
 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()
コード例 #5
0
 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()
コード例 #6
0
 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()