From 614b40051120971a022e66d0fe4827ae917f5d0c Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sat, 17 May 2008 00:09:52 -0300 Subject: [PATCH] Improve procman testcase. --- pymin/procman.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/pymin/procman.py b/pymin/procman.py index 9816997..359b3c0 100644 --- a/pymin/procman.py +++ b/pymin/procman.py @@ -231,24 +231,43 @@ if __name__ == '__main__': print 'test-service count =', count count += 1 if count > 4: - print 'test-service not persistent anymore, start test2' + print 'set test-service non-persistent, start test-service-2' pi.persist = False - pm.start('test2') + assert 'test-service-2' not in manager.namemap + pm.start('test-service-2') + assert 'test-service-2' in manager.namemap print 'died:', pi.name, pi.command register('test-service', ('sleep', '2'), notify, True) - register('test2', ('sleep', '3'), notify, False) + assert 'test-service' in manager.services + assert 'test-service' not in manager.namemap + + register('test-service-2', ('sleep', '3'), notify, False) + assert 'test-service-2' in manager.services + assert 'test-service-2' not in manager.namemap signal.signal(signal.SIGCHLD, SIGCHLD_handler) - call('test', ('sleep', '5'), notify) + call('test-once', ('sleep', '5'), notify) + assert 'test-once' not in manager.services + assert 'test-once' in manager.namemap + start('test-service') + assert 'test-service' in manager.namemap - print "Esperando...", [pi.name for pi in manager.namemap.values()] + print "Known processes:", manager.services.keys() + print "Waiting...", manager.namemap.keys() + print "------------------------------------------------------------------" while manager.pidmap: signal.pause() if sig == signal.SIGCHLD: sigchild_handler(sig) sig = None - print "Esperando...", [pi.name for pi in manager.namemap.values()] + print "Known processes:", manager.services.keys() + print "Waiting...", manager.namemap.keys() + print "------------------------------------------------------------------" + assert 'test-service' not in manager.namemap + assert 'test-service-2' not in manager.namemap + assert 'test-once' not in manager.services + assert 'test-once' not in manager.namemap -- 2.43.0