1
0
mirror of https://github.com/rancher/os.git synced 2025-08-15 05:26:21 +00:00

Modify the tests to work with multiple architectures

This commit is contained in:
Ivan Mikushin 2016-03-30 17:48:31 -07:00
parent 99c3207b14
commit 95d24ac67d
7 changed files with 28 additions and 15 deletions

View File

@ -18,12 +18,15 @@ def test_system_boot(qemu):
u.flush_out(qemu.stdout, 'RancherOS {v} started'.format(v=version))
busybox = {'amd64': 'busybox', 'arm': 'armhf/busybox', 'arm64': 'aarch64/busybox'}
@pytest.mark.timeout(60)
def test_run_system_container(qemu):
u.wait_for_ssh(qemu)
ssh = subprocess.Popen(
'./scripts/ssh --qemu sudo system-docker run --rm busybox /bin/true',
'./scripts/ssh --qemu sudo system-docker run --rm ' + busybox[u.arch] + ' /bin/true',
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
for ln in u.iter_lines(ssh.stdout):

View File

@ -10,10 +10,14 @@ ssh_command = ['./scripts/ssh', '--qemu', '--key', './tests/integration/assets/t
cloud_config_path = './tests/integration/assets/test_01/cloud-config.yml'
net_args = {'amd64': ['-net', 'nic,vlan=1,model=virtio', '-net', 'user,vlan=1,net=10.10.2.0/24'],
'arm64': ['-netdev', 'user,id=net1,net=10.10.2.0/24', '-device', 'virtio-net-device,netdev=net1']}
net_args['arm'] = net_args['arm64']
@pytest.fixture(scope="module")
def qemu(request):
q = u.run_qemu(request, ['--cloud-config', cloud_config_path,
'-net', 'nic,vlan=1,model=virtio', '-net', 'user,vlan=1,net=10.10.2.0/24'])
q = u.run_qemu(request, ['--cloud-config', cloud_config_path] + net_args[u.arch])
u.flush_out(q.stdout)
return q

View File

@ -14,10 +14,13 @@ def qemu(request):
return q
nginx = {'amd64': 'nginx', 'arm': 'armhfbuild/nginx', 'arm64': 'armhfbuild/nginx'}
@pytest.mark.timeout(40)
def test_reboot_with_container_running(qemu):
u.wait_for_ssh(qemu, ssh_command)
subprocess.check_call(ssh_command + ['docker', 'run', '-d', '--restart=always', 'nginx'],
subprocess.check_call(ssh_command + ['docker', 'run', '-d', '--restart=always', nginx[u.arch]],
stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.call(ssh_command + ['sudo', 'reboot'],

View File

@ -20,7 +20,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.1'],
'-i', 'rancher/os:v0.4.4-dev' + u.suffix],
stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.call(ssh_command + ['sudo', 'reboot'],

View File

@ -13,18 +13,21 @@ def qemu(request):
u.flush_out(q.stdout)
return q
docker_url = {'amd64': 'https://experimental.docker.com/builds/Linux/x86_64/docker-1.10.0-dev',
'arm': 'https://github.com/rancher/docker/releases/download/v1.10.3-arm/docker-1.10.3_arm',
'arm64': 'https://github.com/rancher/docker/releases/download/v1.10.3-arm/docker-1.10.3_arm64'}
@pytest.mark.timeout(40)
def test_system_docker_survives_custom_docker_install(qemu):
u.wait_for_ssh(qemu, ssh_command)
subprocess.check_call(ssh_command + ['curl', '-OL',
'https://experimental.docker.com/builds/Linux/x86_64/docker-1.10.0-dev'],
subprocess.check_call(ssh_command + ['curl', '-Lfo', './docker', docker_url[u.arch]],
stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker-1.10.0-dev'],
subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker'],
stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['sudo', 'ln', '-sf', '/home/rancher/docker-1.10.0-dev', '/usr/bin/docker'],
subprocess.check_call(ssh_command + ['sudo', 'ln', '-sf', '/home/rancher/docker', '/usr/bin/docker'],
stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'restart', 'docker'],

View File

@ -1,6 +0,0 @@
def func(x):
return x + 1
def test_answer():
assert func(3) == 4

View File

@ -1,12 +1,18 @@
from __future__ import print_function
import itertools as it
import os
import subprocess
import time
import pytest
ros_test = 'ros-test'
arch = os.environ['ARCH']
suffix = ''
if arch != 'amd64':
suffix = '_' + arch
def iter_lines(s):