mirror of
https://github.com/rancher/os.git
synced 2025-08-10 19:12:30 +00:00
integration tests: use session and module fixtures
This commit is contained in:
parent
e4f04c698f
commit
38d67b20d1
8
tests/integration/rancherostest/conftest.py
Normal file
8
tests/integration/rancherostest/conftest.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import os
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
|
def my_own_session_run_at_beginning():
|
||||||
|
os.chdir('../..')
|
||||||
|
print('\nChdir to project root dir')
|
@ -1,21 +1,25 @@
|
|||||||
import os
|
import pytest
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def qemu(request):
|
||||||
|
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
def fin():
|
||||||
|
p.stdout.close()
|
||||||
|
p.terminate()
|
||||||
|
|
||||||
|
request.addfinalizer(fin)
|
||||||
|
return p
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(20)
|
@pytest.mark.timeout(20)
|
||||||
def test_system_boot():
|
def test_system_boot(qemu):
|
||||||
os.chdir('../..')
|
for ln in iter(qemu.stdout.readline, ''):
|
||||||
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
l = string.strip(ln)
|
||||||
try:
|
ros_booted_substr = string.find(l, 'RancherOS v0.3.1-rc2 started')
|
||||||
for ln in iter(p.stdout.readline, ''):
|
if ros_booted_substr > -1:
|
||||||
l = string.strip(ln)
|
assert True
|
||||||
ros_booted_substr = string.find(l, 'RancherOS v0.3.1-rc2 started')
|
return
|
||||||
if ros_booted_substr > -1:
|
|
||||||
assert True
|
|
||||||
return
|
|
||||||
finally:
|
|
||||||
p.stdout.close()
|
|
||||||
p.terminate()
|
|
||||||
p.wait()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user