Skip to content

Commit fb9c567

Browse files
committed
test: use utils.check_output for daemonization
The open-coded subprocess.Popen sequence in Microvm.spawn was equivalent to `utils.check_output(..., shell=False)`, so just use that. Signed-off-by: Patrick Roy <[email protected]>
1 parent a4c0913 commit fb9c567

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

tests/framework/microvm.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -594,14 +594,7 @@ def spawn(
594594
# When the daemonize flag is on, we want to clone-exec into the
595595
# jailer rather than executing it via spawning a shell.
596596
if self.jailer.daemonize:
597-
res = subprocess.Popen(
598-
cmd,
599-
stdout=subprocess.PIPE,
600-
stderr=subprocess.PIPE,
601-
)
602-
stdout, stderr = res.communicate()
603-
if res.returncode != 0:
604-
raise RuntimeError(res.returncode, stdout, stderr)
597+
utils.check_output(cmd, shell=False)
605598
else:
606599
# Run Firecracker under screen. This is used when we want to access
607600
# the serial console. The file will collect the output from

tests/integration_tests/security/test_jail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def test_negative_no_file_limit(uvm_plain):
533533
# pylint: disable=W0703
534534
try:
535535
test_microvm.spawn()
536-
except RuntimeError as error:
536+
except ChildProcessError as error:
537537
assert "No file descriptors available (os error 24)" in str(error)
538538
else:
539539
assert False, "Negative test failed"

0 commit comments

Comments
 (0)