mirror of
https://github.com/rancher/os.git
synced 2025-08-15 13:35:17 +00:00
Modify the tests to work with multiple architectures
This commit is contained in:
parent
99c3207b14
commit
95d24ac67d
@ -18,12 +18,15 @@ def test_system_boot(qemu):
|
|||||||
u.flush_out(qemu.stdout, 'RancherOS {v} started'.format(v=version))
|
u.flush_out(qemu.stdout, 'RancherOS {v} started'.format(v=version))
|
||||||
|
|
||||||
|
|
||||||
|
busybox = {'amd64': 'busybox', 'arm': 'armhf/busybox', 'arm64': 'aarch64/busybox'}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(60)
|
@pytest.mark.timeout(60)
|
||||||
def test_run_system_container(qemu):
|
def test_run_system_container(qemu):
|
||||||
u.wait_for_ssh(qemu)
|
u.wait_for_ssh(qemu)
|
||||||
|
|
||||||
ssh = subprocess.Popen(
|
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)
|
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
|
||||||
for ln in u.iter_lines(ssh.stdout):
|
for ln in u.iter_lines(ssh.stdout):
|
||||||
|
@ -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'
|
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")
|
@pytest.fixture(scope="module")
|
||||||
def qemu(request):
|
def qemu(request):
|
||||||
q = u.run_qemu(request, ['--cloud-config', cloud_config_path,
|
q = u.run_qemu(request, ['--cloud-config', cloud_config_path] + net_args[u.arch])
|
||||||
'-net', 'nic,vlan=1,model=virtio', '-net', 'user,vlan=1,net=10.10.2.0/24'])
|
|
||||||
u.flush_out(q.stdout)
|
u.flush_out(q.stdout)
|
||||||
return q
|
return q
|
||||||
|
|
||||||
|
@ -14,10 +14,13 @@ def qemu(request):
|
|||||||
return q
|
return q
|
||||||
|
|
||||||
|
|
||||||
|
nginx = {'amd64': 'nginx', 'arm': 'armhfbuild/nginx', 'arm64': 'armhfbuild/nginx'}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(40)
|
@pytest.mark.timeout(40)
|
||||||
def test_reboot_with_container_running(qemu):
|
def test_reboot_with_container_running(qemu):
|
||||||
u.wait_for_ssh(qemu, ssh_command)
|
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)
|
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
|
||||||
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
||||||
|
@ -20,7 +20,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.1'],
|
'-i', 'rancher/os:v0.4.4-dev' + u.suffix],
|
||||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
|
||||||
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
||||||
|
@ -13,18 +13,21 @@ def qemu(request):
|
|||||||
u.flush_out(q.stdout)
|
u.flush_out(q.stdout)
|
||||||
return q
|
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)
|
@pytest.mark.timeout(40)
|
||||||
def test_system_docker_survives_custom_docker_install(qemu):
|
def test_system_docker_survives_custom_docker_install(qemu):
|
||||||
u.wait_for_ssh(qemu, ssh_command)
|
u.wait_for_ssh(qemu, ssh_command)
|
||||||
subprocess.check_call(ssh_command + ['curl', '-OL',
|
subprocess.check_call(ssh_command + ['curl', '-Lfo', './docker', docker_url[u.arch]],
|
||||||
'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.10.0-dev'],
|
subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker'],
|
||||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
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)
|
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'],
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
def func(x):
|
|
||||||
return x + 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_answer():
|
|
||||||
assert func(3) == 4
|
|
@ -1,12 +1,18 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import itertools as it
|
import itertools as it
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
ros_test = 'ros-test'
|
ros_test = 'ros-test'
|
||||||
|
arch = os.environ['ARCH']
|
||||||
|
|
||||||
|
suffix = ''
|
||||||
|
if arch != 'amd64':
|
||||||
|
suffix = '_' + arch
|
||||||
|
|
||||||
|
|
||||||
def iter_lines(s):
|
def iter_lines(s):
|
||||||
|
Loading…
Reference in New Issue
Block a user