Skip to content

Commit 130af91

Browse files
committed
refactor(test): Use check_output in check_guest_connections
Now that the assertion on the `run` return code is paired with the .run call itself, combine them into .check_output. Also use check_output further up. Signed-off-by: Patrick Roy <[email protected]>
1 parent fc23b71 commit 130af91

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/framework/utils_vsock.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ def check_guest_connections(vm, server_port_path, blob_path, blob_hash):
156156
# Avoids: "bash: fork: retry: Resource temporarily unavailable"
157157
# Needed to execute the bash script that tests for concurrent
158158
# vsock guest initiated connections.
159-
pids_max_file = "/sys/fs/cgroup/system.slice/ssh.service/pids.max"
160-
ecode, _, _ = vm.ssh.run(f"echo 1024 > {pids_max_file}")
161-
assert ecode == 0, "Unable to set max process count for guest ssh service."
159+
vm.ssh.check_output(
160+
"echo 1024 > /sys/fs/cgroup/system.slice/ssh.service/pids.max"
161+
)
162162

163163
# Build the guest worker sub-command.
164164
# `vsock_helper` will read the blob file from STDIN and send the echo
@@ -183,9 +183,7 @@ def check_guest_connections(vm, server_port_path, blob_path, blob_hash):
183183
cmd += "done;"
184184
cmd += "for w in $workers; do wait $w || (wait; exit 1); done"
185185

186-
ecode, _, stderr = vm.ssh.run(cmd)
187-
188-
assert ecode == 0, stderr
186+
vm.ssh.check_output(cmd)
189187
finally:
190188
echo_server.terminate()
191189
rc = echo_server.wait()

0 commit comments

Comments
 (0)