mirror of
https://github.com/rancher/os.git
synced 2025-06-30 08:41:48 +00:00
wip: test cloud-config
This commit is contained in:
parent
b64b31a952
commit
070162eb55
8
tests/integration/assets/cloud-config-1.yml
Normal file
8
tests/integration/assets/cloud-config-1.yml
Normal file
@ -0,0 +1,8 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
environment:
|
||||
ETCD_DISCOVERY: https://discovery.etcd.io/c2c219023108cda9529364d6d983fe13
|
||||
FLANNEL_NETWORK: 10.244.0.0/16
|
||||
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUlsWAL5Rf0Wis/A7k7Tlqx0fZS60VzCZrPZYbP/wkL95jv0XzCx8bd1rZHeybblHPDNpND3BLv4qPY5DxRyexF4seGuzcJI/pOvGUGjQondeMPgDTFEo5w939gSdeTZcfXzQ0wAVhzwDbgH4zPfMzbdoo8Aiu9jkKljXw8IFju0gh+t6iKkGZCIjKT9o7zza1vGfkodhvi2V3VzPdNO28gaxZaRNtmBYUoVnGyR6nXN1Q3CJaVuh5o6GPCOqrhHNbYOFZKBpDiHbxPhVpxHQD2+8yUSGTG7WW75FfZePja5y8d0c/O5L37ZYx4AZAd3KgQYDBT2XCEJGQNawNbfpt
|
27
tests/integration/assets/test.key
Normal file
27
tests/integration/assets/test.key
Normal file
@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEA1JbFgC+UX9ForPwO5O05asdH2UutFcwmaz2WGz/8JC/eY79F
|
||||
8wsfG3da2R3sm25RzwzaTQ9wS7+Kj2OQ8UcnsReLHhrs3CSP6TrxlBo0KJ3XjD4A
|
||||
0xRKOcPd/YEnXk2XH180NMAFYc8A24B+Mz3zM23aKPAIrvY5CpY18PCBY7tIIfre
|
||||
oipBmQiIyk/aO882tbxn5KHYb4tld1cz3TTtvIGsWWkTbZgWFKFZxskep1zdUNwi
|
||||
WlboeaOhjwjqq4RzW2DhWSgaQ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romhIVMg7eqbz
|
||||
FXneBQaI/KonYQyrgFjIZY41E30GWAiNjiOGnkjMJf7UKSSlElRKucELBPLqGJ2s
|
||||
vlvc6zXPCP8MhQ5/9J7OX1kXgEoxiOkh9nG8617xjOrlTWsG/oYCGk6gpgXrkUDy
|
||||
/erUFQKBgQDY8h3pTIC3ZvFcy0+UpvVMceLWfaP9+/8dTpAr0HClNOjQC0Fuq6cV
|
||||
nazAREnDB62y4keGV5xcZdHQ9bZBR4dq4h1oFQUq7RJr5fsgaxN13JPJht2xf/ra
|
||||
hK3WKZN5oa/hrRu5m+z9rOwR4T7B863cBs/b1YNj3eKUIakHJEv5xw==
|
||||
-----END RSA PRIVATE KEY-----
|
@ -29,7 +29,7 @@ def test_system_boot(qemu):
|
||||
assert False
|
||||
|
||||
|
||||
@pytest.mark.timeout(40)
|
||||
@pytest.mark.timeout(60)
|
||||
def test_run_system_container(qemu):
|
||||
assert qemu.returncode is None
|
||||
|
28
tests/integration/rancherostest/test_01_cloud_config.py
Normal file
28
tests/integration/rancherostest/test_01_cloud_config.py
Normal file
@ -0,0 +1,28 @@
|
||||
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_check_whats_going_on(qemu):
|
||||
assert qemu.returncode is 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
|
@ -19,6 +19,6 @@ def run_qemu(request, run_args=[]):
|
||||
|
||||
|
||||
@pytest.mark.timeout(10)
|
||||
def wait_for_ssh():
|
||||
while subprocess.call(['./scripts/ssh', '/bin/true']) != 0:
|
||||
def wait_for_ssh(ssh_command=['./scripts/ssh']):
|
||||
while subprocess.call(ssh_command + ['/bin/true']) != 0:
|
||||
time.sleep(1)
|
||||
|
Loading…
Reference in New Issue
Block a user