mirror of
https://github.com/rancher/os.git
synced 2025-08-31 22:32:14 +00:00
factor out util
This commit is contained in:
24
tests/integration/rancherostest/util.py
Normal file
24
tests/integration/rancherostest/util.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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():
|
||||
while subprocess.call(['./scripts/ssh', '/bin/true']) != 0:
|
||||
time.sleep(1)
|
Reference in New Issue
Block a user