mirror of
https://github.com/rancher/os.git
synced 2025-08-01 23:17:50 +00:00
use with
for ssh subprocess
This commit is contained in:
parent
83f0b3057a
commit
b64b31a952
@ -32,17 +32,14 @@ def test_system_boot(qemu):
|
|||||||
@pytest.mark.timeout(40)
|
@pytest.mark.timeout(40)
|
||||||
def test_run_system_container(qemu):
|
def test_run_system_container(qemu):
|
||||||
assert qemu.returncode is None
|
assert qemu.returncode is None
|
||||||
|
|
||||||
u.wait_for_ssh()
|
u.wait_for_ssh()
|
||||||
ssh = subprocess.Popen(
|
ssh = subprocess.Popen(
|
||||||
'./scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True,
|
'./scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
|
||||||
try:
|
with ssh, ssh.stdout as f:
|
||||||
with ssh.stdout as f:
|
for ln in iter(f.readline, ''):
|
||||||
for ln in iter(f.readline, ''):
|
print(str.strip(ln))
|
||||||
print(str.strip(ln))
|
|
||||||
ssh.wait()
|
assert ssh.returncode == 0
|
||||||
assert ssh.returncode == 0
|
|
||||||
finally:
|
|
||||||
if ssh.returncode is None:
|
|
||||||
ssh.terminate()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user