tests: fix FD leak in qrexec test
Terminate dangling process to avoid FD leak (detected by test cleanup code).
This commit is contained in:
parent
4a2e0bc734
commit
80c0a0caa8
@ -20,6 +20,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@ -585,6 +586,10 @@ class TC_00_QrexecMixin(object):
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
self.fail(
|
self.fail(
|
||||||
"service timeout, probably EOF wasn't transferred from the VM process")
|
"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',
|
self.assertEqual(stdout, b'test\n',
|
||||||
'Received data differs from what was expected')
|
'Received data differs from what was expected')
|
||||||
@ -633,6 +638,10 @@ class TC_00_QrexecMixin(object):
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
self.fail(
|
self.fail(
|
||||||
"service timeout, probably EOF wasn't transferred from the VM process")
|
"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'
|
service_descriptor = b'test.Socket+ test-inst-vm1 keyword adminvm\0'
|
||||||
self.assertEqual(service_stdout, service_descriptor + b'test1test2',
|
self.assertEqual(service_stdout, service_descriptor + b'test1test2',
|
||||||
|
Loading…
Reference in New Issue
Block a user