correct some check, and improve signal action
This commit is contained in:
parent
c3d115b970
commit
aff822c534
3 changed files with 11 additions and 9 deletions
|
@ -1425,8 +1425,12 @@ class Manager():
|
|||
pass
|
||||
if self.serverHttp:
|
||||
logging.info("send signal to server http")
|
||||
self.serverHttp.terminate()
|
||||
try:
|
||||
self.serverHttp.terminate()
|
||||
except AttributeError:
|
||||
pass
|
||||
logging.info("Finalize signal (%d)" % (signum))
|
||||
os._exit(0)
|
||||
|
||||
def wait_children_commands(self):
|
||||
for child in self.threadCommand:
|
||||
|
|
|
@ -96,18 +96,17 @@ class TestManager(unittest.TestCase):
|
|||
time.sleep(1)
|
||||
signal.alarm(10)
|
||||
msgjson = client.send_json({'name': 'command:test'}, 'GET', "/STATUS", show_result=False)
|
||||
assert msgjson == {'state' : 'stopped'}
|
||||
self.assertEqual(msgjson['state'], 'stopped')
|
||||
msgjson = client.send_json({'name': 'command:test'}, 'POST', "/START", show_result=False)
|
||||
assert msgjson == {'state' : 'started'}
|
||||
self.assertEqual(msgjson['state'], 'started')
|
||||
msgjson = client.send_json({'name': 'command:test'}, 'GET', "/STATUS", show_result=False)
|
||||
assert msgjson == {'state' : 'started'}
|
||||
self.assertEqual(msgjson['state'], 'started')
|
||||
msgjson = client.send_json({'name': 'command:test', 'action': 'test'}, 'POST', "/STDIN", show_result=False)
|
||||
print(msgjson)
|
||||
assert msgjson == {'state' : 'ok'}
|
||||
self.assertEqual(msgjson['state'], 'ok')
|
||||
msgjson = client.send_json({'name': 'command:test'}, 'POST', "/STOP", show_result=False)
|
||||
assert msgjson == {'state' : 'stopped'}
|
||||
self.assertEqual(msgjson['state'], 'stopped')
|
||||
msgjson = client.send_json({'name': 'command:test'}, 'GET', "/STATUS", show_result=False)
|
||||
assert msgjson == {'state' : 'stopped'}
|
||||
self.assertEqual(msgjson['state'], 'stopped')
|
||||
|
||||
manage.receive_signal(15, 1)
|
||||
manage.wait_children_commands()
|
||||
|
|
|
@ -1264,7 +1264,6 @@ class TestManager(unittest.TestCase):
|
|||
manage.rfile.define_return( '{"name": "test", "first-line" : "1"}' )
|
||||
manage.headers = {'content-length' : '1000', 'content-type' : 'application/json'}
|
||||
manage._command_log()
|
||||
print(manage.wfile.message)
|
||||
self.assertEqual(b'"empty"',manage.wfile.message)
|
||||
signal.alarm(0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue