uitests: Give more time for graceful app shutdown

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-08-26 15:04:03 -04:00
parent 69ebf852ca
commit 632f07b2bb
1 changed files with 13 additions and 11 deletions

View File

@ -562,16 +562,18 @@ class VMMDogtailApp(object):
self._proc = None
return
# Wait for shutdown for 1 second, with 20 checks
for ignore in range(20):
time.sleep(.05)
if self._proc.poll() is not None:
self._proc = None
return
def _wait_for_exit():
# Wait for shutdown for 2 sec
waittime = 2
for ignore in range(int(waittime / .05)):
time.sleep(.05)
if self._proc.poll() is not None:
self._proc = None
return True
if _wait_for_exit():
return
log.warning("App didn't exit gracefully from SIGINT. Killing...")
try:
self._proc.kill()
finally:
time.sleep(1)
self._proc = None
self._proc.kill()
_wait_for_exit()