mirror of
https://github.com/rancher/os.git
synced 2025-09-09 18:50:04 +00:00
test_rancher_environment
This commit is contained in:
@@ -1,15 +1,22 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import rancherostest.util as u
|
import rancherostest.util as u
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
ssh_command = ['ssh', '-p', '2222', '-F', './assets/scripts_ssh_config', '-i', './tests/integration/assets/test.key',
|
ssh_command = ['ssh', '-p', '2222', '-F', './assets/scripts_ssh_config', '-i', './tests/integration/assets/test.key',
|
||||||
'rancher@localhost']
|
'rancher@localhost']
|
||||||
|
cloud_config_path = './tests/integration/assets/cloud-config-01.yml'
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def qemu(request):
|
def qemu(request):
|
||||||
return u.run_qemu(request, ['--cloud-config', './tests/integration/assets/cloud-config-1.yml'])
|
return u.run_qemu(request, ['--cloud-config', cloud_config_path])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def cloud_config_01():
|
||||||
|
return yaml.load(open(cloud_config_path))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(40)
|
@pytest.mark.timeout(40)
|
||||||
@@ -20,16 +27,12 @@ def test_ssh_authorized_keys(qemu):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(40)
|
@pytest.mark.timeout(40)
|
||||||
def test_rancher_environment(qemu):
|
def test_rancher_environment(qemu, cloud_config_01):
|
||||||
assert qemu is not None
|
assert qemu is not None
|
||||||
u.wait_for_ssh(ssh_command)
|
u.wait_for_ssh(ssh_command)
|
||||||
|
|
||||||
ssh = subprocess.Popen(
|
v = subprocess.check_output(
|
||||||
ssh_command + ['sudo', 'rancherctl', 'c', 'get', 'environment'],
|
ssh_command + ['sudo', 'rancherctl', 'env', 'printenv', 'FLANNEL_NETWORK'],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
|
||||||
with ssh, ssh.stdout as f:
|
assert v.strip() == cloud_config_01['rancher']['environment']['FLANNEL_NETWORK']
|
||||||
for ln in iter(f.readline, ''):
|
|
||||||
print(str.strip(ln))
|
|
||||||
|
|
||||||
assert ssh.returncode == 0
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
PyYAML.Yandex==3.11.1
|
||||||
flake8==2.4.0
|
flake8==2.4.0
|
||||||
mccabe==0.3
|
mccabe==0.3
|
||||||
pep8==1.6.2
|
pep8==1.6.2
|
||||||
|
Reference in New Issue
Block a user