1
0
mirror of https://github.com/rancher/os.git synced 2025-06-30 08:41:48 +00:00
os/tests/integration/rancherostest/util.py
2015-05-10 17:46:10 +05:00

25 lines
625 B
Python

import pytest
import subprocess
import time
def run_qemu(request, run_args=[]):
subprocess.check_call('rm ./state/*', shell=True)
print('\nrm ./state/*')
print('\nStarting QEMU')
p = subprocess.Popen(['./scripts/run'] + run_args,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
def fin():
print('\nTerminating QEMU')
p.terminate()
request.addfinalizer(fin)
return p
@pytest.mark.timeout(10)
def wait_for_ssh(ssh_command=['./scripts/ssh']):
while subprocess.call(ssh_command + ['/bin/true']) != 0:
time.sleep(1)