mirror of
https://github.com/rancher/os.git
synced 2025-07-16 08:05:51 +00:00
Merge pull request #653 from imikushin/moar-tests
refactor tests a little bit
This commit is contained in:
commit
27c8e1ed15
3
main.go
3
main.go
@ -50,8 +50,7 @@ func main() {
|
||||
registerCmd("/sbin/halt", power.Halt)
|
||||
registerCmd("/sbin/shutdown", power.Main)
|
||||
registerCmd("/usr/bin/respawn", respawn.Main)
|
||||
registerCmd("/usr/sbin/rancherctl", control.Main) // deprecated, use `ros` instead
|
||||
registerCmd("/usr/sbin/ros", control.Main)
|
||||
registerCmd("/usr/bin/ros", control.Main)
|
||||
registerCmd("/usr/bin/cloud-init", cloudinit.Main)
|
||||
registerCmd("/usr/sbin/netconf", network.Main)
|
||||
registerCmd("/usr/sbin/wait-for-network", waitfornetwork.Main)
|
||||
|
@ -130,8 +130,7 @@ rancher:
|
||||
- /usr/bin/ros:/sbin/halt:ro
|
||||
- /usr/bin/ros:/sbin/shutdown:ro
|
||||
- /usr/bin/ros:/usr/bin/respawn:ro
|
||||
- /usr/bin/ros:/usr/sbin/rancherctl:ro
|
||||
- /usr/bin/ros:/usr/sbin/ros:ro
|
||||
- /usr/bin/ros:/usr/bin/ros:ro
|
||||
- /usr/bin/ros:/usr/bin/cloud-init:ro
|
||||
- /usr/bin/ros:/usr/sbin/netconf:ro
|
||||
- /usr/bin/ros:/usr/sbin/wait-for-network:ro
|
||||
|
@ -2,7 +2,7 @@ from __future__ import print_function
|
||||
import itertools as it
|
||||
import pytest
|
||||
import subprocess
|
||||
import rancherostest.util as u
|
||||
import rostest.util as u
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
import rancherostest.util as u
|
||||
import rostest.util as u
|
||||
import string
|
||||
import subprocess
|
||||
import yaml
|
||||
@ -33,7 +33,7 @@ def test_rancher_environment(qemu, cloud_config):
|
||||
u.wait_for_ssh(ssh_command)
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
|
||||
@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)
|
||||
def test_docker_tls_args(qemu, cloud_config):
|
||||
assert qemu is not None
|
@ -2,7 +2,7 @@ from __future__ import print_function
|
||||
import itertools as it
|
||||
import pytest
|
||||
import subprocess
|
||||
import rancherostest.util as u
|
||||
import rostest.util as u
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
import rancherostest.util as u
|
||||
import rostest.util as u
|
||||
import subprocess
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
import rancherostest.util as u
|
||||
import rostest.util as u
|
||||
import subprocess
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ def test_ros_install_on_formatted_disk(qemu):
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
|
||||
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)
|
||||
|
||||
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
import rancherostest.util as u
|
||||
import rostest.util as u
|
||||
import subprocess
|
||||
|
||||
|
||||
@ -17,13 +17,13 @@ def test_system_docker_survives_custom_docker_install(qemu):
|
||||
assert qemu is not None
|
||||
u.wait_for_ssh(ssh_command)
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'restart', 'docker'],
|
@ -4,7 +4,7 @@ setup(
|
||||
name='RancherOSIntegrationTests',
|
||||
version='0.1',
|
||||
packages=[
|
||||
'rancherostest'
|
||||
'rostest'
|
||||
],
|
||||
license='ASL 2.0',
|
||||
long_description=open('README.txt').read(),
|
||||
|
@ -4,11 +4,11 @@ skipsdist=True
|
||||
|
||||
[testenv]
|
||||
deps=-rrequirements.txt
|
||||
commands=py.test -s --durations=20 rancherostest {posargs}
|
||||
commands=py.test -s --durations=20 rostest {posargs}
|
||||
|
||||
[testenv:flake8]
|
||||
deps=flake8
|
||||
commands=flake8 rancherostest
|
||||
commands=flake8 rostest
|
||||
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
|
Loading…
Reference in New Issue
Block a user