1
0
mirror of https://github.com/rancher/os.git synced 2025-07-30 22:24:33 +00:00

test rebooting instance with a container running in user docker

This commit is contained in:
Ivan Mikushin 2015-09-14 14:01:39 +05:00
parent fd90dcffe0
commit f08f996bca
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#cloud-config
rancher:
services_include:
debian-console: true
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUlsWAL5Rf0Wis/A7k7Tlqx0fZS60VzCZrPZYbP/wkL95jv0XzCx8bd1rZHeybblHPDNpND3BLv4qPY5DxRyexF4seGuzcJI/pOvGUGjQondeMPgDTFEo5w939gSdeTZcfXzQ0wAVhzwDbgH4zPfMzbdoo8Aiu9jkKljXw8IFju0gh+t6iKkGZCIjKT9o7zza1vGfkodhvi2V3VzPdNO28gaxZaRNtmBYUoVnGyR6nXN1Q3CJaVuh5o6GPCOqrhHNbYOFZKBpDiHbxPhVpxHQD2+8yUSGTG7WW75FfZePja5y8d0c/O5L37ZYx4AZAd3KgQYDBT2XCEJGQNawNbfpt

View File

@ -0,0 +1,36 @@
import pytest
import rancherostest.util as u
import subprocess
import yaml
ssh_command = ['ssh', '-p', '2222', '-F', './assets/scripts_ssh_config', '-i', './tests/integration/assets/test.key',
'rancher@localhost']
cloud_config_path = './tests/integration/assets/test_03/cloud-config.yml'
@pytest.fixture(scope="module")
def qemu(request):
return u.run_qemu(request, ['--cloud-config', cloud_config_path])
@pytest.fixture(scope="module")
def cloud_config():
return yaml.load(open(cloud_config_path))
@pytest.mark.timeout(40)
def test_reboot_with_container_running(qemu):
assert qemu is not None
u.wait_for_ssh(ssh_command)
subprocess.check_call(ssh_command + ['docker', 'run', '-d', '--restart=always', 'nginx'],
stderr=subprocess.STDOUT, universal_newlines=True)
subprocess.call(ssh_command + ['sudo', 'reboot'],
stderr=subprocess.STDOUT, universal_newlines=True)
u.wait_for_ssh(ssh_command)
v = subprocess.check_output(ssh_command + ['docker', 'ps', '-f', 'status=running'],
stderr=subprocess.STDOUT, universal_newlines=True)
assert v.find('nginx') != -1