1
0
mirror of https://github.com/rancher/os.git synced 2025-07-02 17:51:49 +00:00
os/tests/integration/rancherostest/test_01_cloud_config.py
2015-05-10 17:46:10 +05:00

36 lines
956 B
Python

import pytest
import rancherostest.util as u
import subprocess
ssh_command = ['ssh', '-p', '2222', '-F', './assets/scripts_ssh_config', '-i', './tests/integration/assets/test.key',
'rancher@localhost']
@pytest.fixture(scope="module")
def qemu(request):
return u.run_qemu(request, ['--cloud-config', './tests/integration/assets/cloud-config-1.yml'])
@pytest.mark.timeout(40)
def test_ssh_authorized_keys(qemu):
assert qemu is not None
u.wait_for_ssh(ssh_command)
assert True
@pytest.mark.timeout(40)
def test_rancher_environment(qemu):
assert qemu is not None
u.wait_for_ssh(ssh_command)
ssh = subprocess.Popen(
ssh_command + ['sudo', 'rancherctl', 'c', 'get', 'environment'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
with ssh, ssh.stdout as f:
for ln in iter(f.readline, ''):
print(str.strip(ln))
assert ssh.returncode == 0