mirror of
https://github.com/rancher/os.git
synced 2025-09-03 07:44:21 +00:00
factor out util
This commit is contained in:
0
tests/integration/rancherostest/__init__.py
Normal file
0
tests/integration/rancherostest/__init__.py
Normal file
@@ -1,21 +1,11 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import rancherostest.util as u
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def qemu(request):
|
def qemu(request):
|
||||||
subprocess.check_call('rm ./state/*', shell=True)
|
return u.run_qemu(request)
|
||||||
print('\nrm ./state/*')
|
|
||||||
print('\nStarting QEMU')
|
|
||||||
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
|
||||||
|
|
||||||
def fin():
|
|
||||||
print('\nTerminating QEMU')
|
|
||||||
p.terminate()
|
|
||||||
|
|
||||||
request.addfinalizer(fin)
|
|
||||||
return p
|
|
||||||
|
|
||||||
|
|
||||||
def rancheros_version():
|
def rancheros_version():
|
||||||
@@ -39,16 +29,10 @@ def test_system_boot(qemu):
|
|||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(10)
|
|
||||||
def wait_for_ssh():
|
|
||||||
while subprocess.call(['./scripts/ssh', '/bin/true']) != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
||||||
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)
|
||||||
|
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