tests: kill wcs process in more places (#80373)
gitea/wcs-olap/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2023-08-10 21:16:30 +02:00
parent cd12909483
commit d68ce5a271
1 changed files with 12 additions and 1 deletions

View File

@ -260,11 +260,22 @@ ALLOWED_HOSTS = ['%s']
else:
s.close()
break
assert i < 50, 'no connection found after 5 seconds'
if i >= 50:
try:
os.kill(WCS_PID, 9)
except OSError:
pass
shutil.rmtree(str(wcs_dir))
assert False, 'no connection found after 5 seconds'
# verify w.c.s. is still running
pid, exit_code = os.waitpid(WCS_PID, os.WNOHANG)
if pid:
try:
os.kill(WCS_PID, 9)
except OSError:
pass
shutil.rmtree(str(wcs_dir))
assert False, 'w.c.s. stopped with exit-code %s' % exit_code
yield Wcs(url='http://%s:%s/' % (utils.HOSTNAME, PORT), appdir=wcs_dir, pid=WCS_PID)