tests: fix FD leak in qrexec test

Terminate dangling process to avoid FD leak (detected by test cleanup
code).
This commit is contained in:
Marek Marczykowski-Górecki 2020-07-14 01:12:56 +02:00
parent 4a2e0bc734
commit 80c0a0caa8
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -20,6 +20,7 @@
#
import asyncio
import contextlib
import os
import subprocess
import sys
@ -585,6 +586,10 @@ class TC_00_QrexecMixin(object):
except asyncio.TimeoutError:
self.fail(
"service timeout, probably EOF wasn't transferred from the VM process")
finally:
with contextlib.suppress(ProcessLookupError):
p.terminate()
self.loop.run_until_complete(p.wait())
self.assertEqual(stdout, b'test\n',
'Received data differs from what was expected')
@ -633,6 +638,10 @@ class TC_00_QrexecMixin(object):
except asyncio.TimeoutError:
self.fail(
"service timeout, probably EOF wasn't transferred from the VM process")
finally:
with contextlib.suppress(ProcessLookupError):
p.terminate()
self.loop.run_until_complete(p.wait())
service_descriptor = b'test.Socket+ test-inst-vm1 keyword adminvm\0'
self.assertEqual(service_stdout, service_descriptor + b'test1test2',