1
0
mirror of https://github.com/rancher/os.git synced 2025-09-05 00:37:12 +00:00

make tests run on arm64

This commit is contained in:
Ivan Mikushin
2016-04-01 11:00:42 -07:00
parent e2f3ac78a7
commit 0f6cf07786
5 changed files with 54 additions and 47 deletions

View File

@@ -1,7 +1,8 @@
import subprocess
import time
import pytest
import rostest.util as u
from rostest.util import SSH
ssh_command = ['./scripts/ssh', '--qemu', '--key', './tests/integration/assets/test.key']
cloud_config_path = './tests/integration/assets/test_03/cloud-config.yml'
@@ -19,15 +20,19 @@ 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[u.arch]],
stderr=subprocess.STDOUT, universal_newlines=True)
try:
SSH(qemu, ssh_command).check_call('''
set -ex
docker run -d --restart=always %(image)s
sudo reboot
'''.strip() % {'image': nginx[u.arch]})
except:
pass
subprocess.call(ssh_command + ['sudo', 'reboot'],
stderr=subprocess.STDOUT, universal_newlines=True)
time.sleep(3)
u.wait_for_ssh(qemu, ssh_command)
v = subprocess.check_output(ssh_command + ['docker', 'ps', '-f', 'status=running'],
stderr=subprocess.STDOUT, universal_newlines=True)
v = SSH(qemu, ssh_command).check_output('''
docker ps -f status=running
'''.strip())
assert v.find('nginx') != -1