mirror of
https://github.com/rancher/os.git
synced 2025-08-01 15:08:47 +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 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)
|
||||
def test_system_boot():
|
||||
os.chdir('../..')
|
||||
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
try:
|
||||
for ln in iter(p.stdout.readline, ''):
|
||||
l = string.strip(ln)
|
||||
ros_booted_substr = string.find(l, 'RancherOS v0.3.1-rc2 started')
|
||||
if ros_booted_substr > -1:
|
||||
assert True
|
||||
return
|
||||
finally:
|
||||
p.stdout.close()
|
||||
p.terminate()
|
||||
p.wait()
|
||||
def test_system_boot(qemu):
|
||||
for ln in iter(qemu.stdout.readline, ''):
|
||||
l = string.strip(ln)
|
||||
ros_booted_substr = string.find(l, 'RancherOS v0.3.1-rc2 started')
|
||||
if ros_booted_substr > -1:
|
||||
assert True
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user