1
0
mirror of https://github.com/rancher/os.git synced 2025-07-17 08:31:02 +00:00

Merge pull request #653 from imikushin/moar-tests

refactor tests a little bit
This commit is contained in:
Ivan Mikushin 2015-11-18 17:54:20 +05:00
commit 27c8e1ed15
14 changed files with 28 additions and 18 deletions

View File

@ -50,8 +50,7 @@ func main() {
registerCmd("/sbin/halt", power.Halt) registerCmd("/sbin/halt", power.Halt)
registerCmd("/sbin/shutdown", power.Main) registerCmd("/sbin/shutdown", power.Main)
registerCmd("/usr/bin/respawn", respawn.Main) registerCmd("/usr/bin/respawn", respawn.Main)
registerCmd("/usr/sbin/rancherctl", control.Main) // deprecated, use `ros` instead registerCmd("/usr/bin/ros", control.Main)
registerCmd("/usr/sbin/ros", control.Main)
registerCmd("/usr/bin/cloud-init", cloudinit.Main) registerCmd("/usr/bin/cloud-init", cloudinit.Main)
registerCmd("/usr/sbin/netconf", network.Main) registerCmd("/usr/sbin/netconf", network.Main)
registerCmd("/usr/sbin/wait-for-network", waitfornetwork.Main) registerCmd("/usr/sbin/wait-for-network", waitfornetwork.Main)

View File

@ -130,8 +130,7 @@ rancher:
- /usr/bin/ros:/sbin/halt:ro - /usr/bin/ros:/sbin/halt:ro
- /usr/bin/ros:/sbin/shutdown:ro - /usr/bin/ros:/sbin/shutdown:ro
- /usr/bin/ros:/usr/bin/respawn:ro - /usr/bin/ros:/usr/bin/respawn:ro
- /usr/bin/ros:/usr/sbin/rancherctl:ro - /usr/bin/ros:/usr/bin/ros:ro
- /usr/bin/ros:/usr/sbin/ros:ro
- /usr/bin/ros:/usr/bin/cloud-init:ro - /usr/bin/ros:/usr/bin/cloud-init:ro
- /usr/bin/ros:/usr/sbin/netconf:ro - /usr/bin/ros:/usr/sbin/netconf:ro
- /usr/bin/ros:/usr/sbin/wait-for-network:ro - /usr/bin/ros:/usr/sbin/wait-for-network:ro

View File

@ -2,7 +2,7 @@ from __future__ import print_function
import itertools as it import itertools as it
import pytest import pytest
import subprocess import subprocess
import rancherostest.util as u import rostest.util as u
@pytest.fixture(scope="module") @pytest.fixture(scope="module")

View File

@ -1,5 +1,5 @@
import pytest import pytest
import rancherostest.util as u import rostest.util as u
import string import string
import subprocess import subprocess
import yaml import yaml
@ -33,7 +33,7 @@ def test_rancher_environment(qemu, cloud_config):
u.wait_for_ssh(ssh_command) u.wait_for_ssh(ssh_command)
v = subprocess.check_output( v = subprocess.check_output(
ssh_command + ['sudo', 'rancherctl', 'env', 'printenv', 'FLANNEL_NETWORK'], ssh_command + ['sudo', 'ros', 'env', 'printenv', 'FLANNEL_NETWORK'],
stderr=subprocess.STDOUT, universal_newlines=True) stderr=subprocess.STDOUT, universal_newlines=True)
assert v.strip() == cloud_config['rancher']['environment']['FLANNEL_NETWORK'] assert v.strip() == cloud_config['rancher']['environment']['FLANNEL_NETWORK']
@ -53,6 +53,18 @@ def test_docker_args(qemu, cloud_config):
assert v.find(expected) != -1 assert v.find(expected) != -1
@pytest.mark.timeout(40)
def test_dhcpcd(qemu, cloud_config):
assert qemu is not None
u.wait_for_ssh(ssh_command)
v = subprocess.check_output(
ssh_command + ['sh', '-c', 'ps -ef | grep dhcpcd'],
stderr=subprocess.STDOUT, universal_newlines=True)
assert v.find('dhcpcd -M') != -1
@pytest.mark.timeout(40) @pytest.mark.timeout(40)
def test_docker_tls_args(qemu, cloud_config): def test_docker_tls_args(qemu, cloud_config):
assert qemu is not None assert qemu is not None

View File

@ -2,7 +2,7 @@ from __future__ import print_function
import itertools as it import itertools as it
import pytest import pytest
import subprocess import subprocess
import rancherostest.util as u import rostest.util as u
@pytest.fixture(scope="module") @pytest.fixture(scope="module")

View File

@ -1,5 +1,5 @@
import pytest import pytest
import rancherostest.util as u import rostest.util as u
import subprocess import subprocess

View File

@ -1,5 +1,5 @@
import pytest import pytest
import rancherostest.util as u import rostest.util as u
import subprocess import subprocess
@ -19,7 +19,7 @@ def test_ros_install_on_formatted_disk(qemu):
stderr=subprocess.STDOUT, universal_newlines=True) stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['sudo', 'ros', 'install', '-f', '--no-reboot', '-d', '/dev/vda', subprocess.check_call(ssh_command + ['sudo', 'ros', 'install', '-f', '--no-reboot', '-d', '/dev/vda',
'-i', 'rancher/os:v0.4.0-dev-test.135'], '-i', 'rancher/os:v0.4.1'],
stderr=subprocess.STDOUT, universal_newlines=True) stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.call(ssh_command + ['sudo', 'reboot'], subprocess.call(ssh_command + ['sudo', 'reboot'],

View File

@ -1,5 +1,5 @@
import pytest import pytest
import rancherostest.util as u import rostest.util as u
import subprocess import subprocess
@ -17,13 +17,13 @@ def test_system_docker_survives_custom_docker_install(qemu):
assert qemu is not None assert qemu is not None
u.wait_for_ssh(ssh_command) u.wait_for_ssh(ssh_command)
subprocess.check_call(ssh_command + ['curl', '-OL', subprocess.check_call(ssh_command + ['curl', '-OL',
'https://get.docker.com/builds/Linux/x86_64/docker-1.9.0'], 'https://experimental.docker.com/builds/Linux/x86_64/docker-1.10.0-dev'],
stderr=subprocess.STDOUT, universal_newlines=True) stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker-1.9.0'], subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker-1.10.0-dev'],
stderr=subprocess.STDOUT, universal_newlines=True) stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['sudo', 'ln', '-sf', '/home/rancher/docker-1.9.0', '/usr/bin/docker'], subprocess.check_call(ssh_command + ['sudo', 'ln', '-sf', '/home/rancher/docker-1.10.0-dev', '/usr/bin/docker'],
stderr=subprocess.STDOUT, universal_newlines=True) stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'restart', 'docker'], subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'restart', 'docker'],

View File

@ -4,7 +4,7 @@ setup(
name='RancherOSIntegrationTests', name='RancherOSIntegrationTests',
version='0.1', version='0.1',
packages=[ packages=[
'rancherostest' 'rostest'
], ],
license='ASL 2.0', license='ASL 2.0',
long_description=open('README.txt').read(), long_description=open('README.txt').read(),

View File

@ -4,11 +4,11 @@ skipsdist=True
[testenv] [testenv]
deps=-rrequirements.txt deps=-rrequirements.txt
commands=py.test -s --durations=20 rancherostest {posargs} commands=py.test -s --durations=20 rostest {posargs}
[testenv:flake8] [testenv:flake8]
deps=flake8 deps=flake8
commands=flake8 rancherostest commands=flake8 rostest
[flake8] [flake8]
max-line-length = 120 max-line-length = 120