1
0
mirror of https://github.com/rancher/os.git synced 2025-07-05 02:56:13 +00:00
os/tests/integration/rancherostest/test_00_system.py

52 lines
1.4 KiB
Python
Raw Normal View History

2015-09-09 06:33:54 +00:00
from __future__ import print_function
import itertools as it
import pytest
2015-05-07 13:59:48 +00:00
import subprocess
2015-05-08 09:10:17 +00:00
import rancherostest.util as u
2015-05-07 13:59:48 +00:00
@pytest.fixture(scope="module")
def qemu(request):
2015-05-08 09:10:17 +00:00
return u.run_qemu(request)
def rancheros_version():
2015-09-09 06:33:54 +00:00
with open('./build.conf') as f:
for v in it.ifilter(u.non_empty,
it.imap(u.parse_value('VERSION'),
it.ifilter(u.non_empty,
it.imap(u.strip_comment('#'), u.iter_lines(f))))):
return v
raise RuntimeError("Could not parse RancherOS version")
@pytest.mark.timeout(30)
def test_system_boot(qemu):
2015-09-01 14:11:02 +00:00
version = rancheros_version()
print('parsed version: ' + version)
2015-09-09 06:33:54 +00:00
def has_ros_started_substr(s):
return str.find(s, 'RancherOS {v} started'.format(v=version)) > -1
for _ in it.ifilter(has_ros_started_substr,
it.imap(u.with_effect(print), u.iter_lines(qemu.stdout))):
assert True
return
2015-05-07 16:01:19 +00:00
assert False
2015-05-08 10:15:14 +00:00
@pytest.mark.timeout(60)
2015-05-07 16:01:19 +00:00
def test_run_system_container(qemu):
2015-05-08 11:23:12 +00:00
assert qemu is not None
2015-05-08 09:10:17 +00:00
u.wait_for_ssh()
2015-05-08 11:23:12 +00:00
2015-05-07 16:01:19 +00:00
ssh = subprocess.Popen(
'./scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True,
2015-05-08 05:42:18 +00:00
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
2015-05-07 16:01:19 +00:00
2015-09-01 14:11:02 +00:00
for ln in u.iter_lines(ssh.stdout):
2015-09-09 06:33:54 +00:00
print(ln)
2015-09-01 14:11:02 +00:00
ssh.wait()
2015-05-08 09:25:11 +00:00
assert ssh.returncode == 0