mirror of
https://github.com/rancher/os.git
synced 2025-09-09 02:31:36 +00:00
test_rancher_environment
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
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/cloud-config-01.yml'
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
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)
|
||||
@@ -20,16 +27,12 @@ def test_ssh_authorized_keys(qemu):
|
||||
|
||||
|
||||
@pytest.mark.timeout(40)
|
||||
def test_rancher_environment(qemu):
|
||||
def test_rancher_environment(qemu, cloud_config_01):
|
||||
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)
|
||||
v = subprocess.check_output(
|
||||
ssh_command + ['sudo', 'rancherctl', 'env', 'printenv', 'FLANNEL_NETWORK'],
|
||||
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
|
||||
assert v.strip() == cloud_config_01['rancher']['environment']['FLANNEL_NETWORK']
|
||||
|
@@ -1,3 +1,4 @@
|
||||
PyYAML.Yandex==3.11.1
|
||||
flake8==2.4.0
|
||||
mccabe==0.3
|
||||
pep8==1.6.2
|
||||
|
Reference in New Issue
Block a user