mirror of
https://github.com/rancher/os.git
synced 2025-06-20 04:01:55 +00:00
revive integration tests
This commit is contained in:
parent
e9371a67cb
commit
e94f8d8a1f
@ -114,7 +114,7 @@ if [ "$UNAME" == "Darwin" ] && [ -x $(which xhyve) ]; then
|
|||||||
mkisofs -R -V config-2 -o "${CLOUD_CONFIG_ISO}" "$(pwd)/cloud-init"
|
mkisofs -R -V config-2 -o "${CLOUD_CONFIG_ISO}" "$(pwd)/cloud-init"
|
||||||
|
|
||||||
echo PWD=`pwd`
|
echo PWD=`pwd`
|
||||||
exec sudo xhyve -A -H -P -u \
|
exec sudo -n xhyve -A -H -P -u \
|
||||||
-m 4G \
|
-m 4G \
|
||||||
-s 0:0,hostbridge -s 31,lpc \
|
-s 0:0,hostbridge -s 31,lpc \
|
||||||
-l com1,stdio \
|
-l com1,stdio \
|
||||||
|
@ -1 +0,0 @@
|
|||||||
RancherOS In-VM Integration Tests
|
|
@ -1,6 +0,0 @@
|
|||||||
def func(x):
|
|
||||||
return x + 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_answer():
|
|
||||||
assert func(3) == 4
|
|
@ -1,3 +0,0 @@
|
|||||||
flake8==2.4.0
|
|
||||||
pytest==2.7.0
|
|
||||||
tox==1.9.2
|
|
@ -1,11 +0,0 @@
|
|||||||
from distutils.core import setup
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name='RancherOSInVMTests',
|
|
||||||
version='0.1',
|
|
||||||
packages=[
|
|
||||||
'rancheros.invmtest'
|
|
||||||
],
|
|
||||||
license='ASL 2.0',
|
|
||||||
long_description=open('README.txt').read(),
|
|
||||||
)
|
|
@ -1,12 +0,0 @@
|
|||||||
[tox]
|
|
||||||
envlist=flake8, py27
|
|
||||||
|
|
||||||
[testenv]
|
|
||||||
deps=-rrequirements.txt
|
|
||||||
changedir={toxinidir}
|
|
||||||
commands=py.test --durations=20 {posargs}
|
|
||||||
|
|
||||||
[testenv:flake8]
|
|
||||||
deps=-rrequirements.txt
|
|
||||||
changedir={toxinidir}
|
|
||||||
commands=flake8 rancheros
|
|
@ -1,10 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session", autouse=True)
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
def chdir_to_project_root():
|
def chdir_to_project_root():
|
||||||
os.chdir('../..')
|
os.chdir('../..')
|
||||||
print('\nChdir to project root dir')
|
print('\nChdir to project root dir: ' + subprocess.check_output('pwd'))
|
||||||
os.chmod('./tests/integration/assets/test.key', 0o600)
|
os.chmod('./tests/integration/assets/test.key', 0o600)
|
||||||
print('Also, `chmod 600 tests/integration/assets/test.key` to make ssh happy')
|
print('Also, `chmod 600 tests/integration/assets/test.key` to make ssh happy')
|
||||||
|
@ -10,7 +10,7 @@ def qemu(request):
|
|||||||
|
|
||||||
def rancheros_version():
|
def rancheros_version():
|
||||||
with open('./scripts/version') as f:
|
with open('./scripts/version') as f:
|
||||||
for ln in iter(f.readline, ''):
|
for ln in f:
|
||||||
(k, _, v) = ln.partition('=')
|
(k, _, v) = ln.partition('=')
|
||||||
if k == 'VERSION' and v.strip() != '':
|
if k == 'VERSION' and v.strip() != '':
|
||||||
return v.strip()
|
return v.strip()
|
||||||
@ -19,9 +19,10 @@ def rancheros_version():
|
|||||||
|
|
||||||
@pytest.mark.timeout(30)
|
@pytest.mark.timeout(30)
|
||||||
def test_system_boot(qemu):
|
def test_system_boot(qemu):
|
||||||
with qemu.stdout as f:
|
version = rancheros_version()
|
||||||
for ln in iter(f.readline, ''):
|
print('parsed version: ' + version)
|
||||||
ros_booted_substr = str.find(ln, 'RancherOS {v} started'.format(v=rancheros_version()))
|
for ln in u.iter_lines(qemu.stdout):
|
||||||
|
ros_booted_substr = str.find(ln, 'RancherOS {v} started'.format(v=version))
|
||||||
print(str.strip(ln))
|
print(str.strip(ln))
|
||||||
if ros_booted_substr > -1:
|
if ros_booted_substr > -1:
|
||||||
assert True
|
assert True
|
||||||
@ -38,8 +39,8 @@ def test_run_system_container(qemu):
|
|||||||
'./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)
|
||||||
|
|
||||||
with ssh, ssh.stdout as f:
|
for ln in u.iter_lines(ssh.stdout):
|
||||||
for ln in iter(f.readline, ''):
|
|
||||||
print(str.strip(ln))
|
print(str.strip(ln))
|
||||||
|
ssh.wait()
|
||||||
|
|
||||||
assert ssh.returncode == 0
|
assert ssh.returncode == 0
|
||||||
|
@ -3,6 +3,9 @@ import subprocess
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
def iter_lines(s):
|
||||||
|
return iter(s.readline, '')
|
||||||
|
|
||||||
def run_qemu(request, run_args=[]):
|
def run_qemu(request, run_args=[]):
|
||||||
subprocess.check_call('rm -f ./state/empty-hd.img', shell=True)
|
subprocess.check_call('rm -f ./state/empty-hd.img', shell=True)
|
||||||
print('\nrm ./state/*')
|
print('\nrm ./state/*')
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
PyYAML.Yandex==3.11.1
|
PyYAML==3.11
|
||||||
flake8==2.4.0
|
flake8==2.4.1
|
||||||
mccabe==0.3
|
mccabe==0.3.1
|
||||||
pep8==1.6.2
|
pep8==1.5.7
|
||||||
py==1.4.27
|
pluggy==0.3.0
|
||||||
|
py==1.4.30
|
||||||
pyflakes==0.8.1
|
pyflakes==0.8.1
|
||||||
pytest==2.7.0
|
pytest==2.7.2
|
||||||
pytest-timeout==0.4
|
tox==2.1.1
|
||||||
tox==1.9.2
|
virtualenv==13.1.2
|
||||||
virtualenv==12.1.1
|
wsgiref==0.1.2
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist=flake8, py34
|
envlist=flake8, py27
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps=-rrequirements.txt
|
deps=-rrequirements.txt
|
||||||
changedir={toxinidir}
|
changedir=rancherostest
|
||||||
commands=py.test --durations=20 {posargs}
|
commands=py.test --durations=20 {posargs}
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
deps=-rrequirements.txt
|
deps=-rrequirements.txt
|
||||||
changedir={toxinidir}
|
changedir=rancherostest
|
||||||
commands=flake8 rancherostest
|
commands=flake8 .
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
|
Loading…
Reference in New Issue
Block a user