From 119b1be0ec391ef15fc92ea6db9a2ad31b97fb3c Mon Sep 17 00:00:00 2001 From: Ivan Mikushin Date: Tue, 17 Nov 2015 18:08:37 +0500 Subject: [PATCH] add docker.tls_args test --- .../assets/test_01/cloud-config.yml | 3 ++- .../rancherostest/test_01_cloud_config.py | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/integration/assets/test_01/cloud-config.yml b/tests/integration/assets/test_01/cloud-config.yml index ed122464..5f4dd988 100644 --- a/tests/integration/assets/test_01/cloud-config.yml +++ b/tests/integration/assets/test_01/cloud-config.yml @@ -10,6 +10,7 @@ rancher: gateway: 10.10.2.2 mtu: 1500 docker: - args: [daemon, --log-opt, max-file=2, --log-opt, max-size=25m, -s, overlay, -G, docker, -H, 'unix:///var/run/docker.sock', -H, 'tcp://0.0.0.0:2375', --userland-proxy=false] + args: [daemon, --log-opt, max-file=2, --log-opt, max-size=25m, -s, overlay, -G, docker, -H, 'unix:///var/run/docker.sock', --userland-proxy=false] + tls_args: [--tlsverify, --tlscacert=/home/rancher/.docker/ca.pem, --tlscert=/home/rancher/.docker/server-cert.pem, --tlskey=/home/rancher/.docker/server-key.pem, '-H=0.0.0.0:2376'] ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUlsWAL5Rf0Wis/A7k7Tlqx0fZS60VzCZrPZYbP/wkL95jv0XzCx8bd1rZHeybblHPDNpND3BLv4qPY5DxRyexF4seGuzcJI/pOvGUGjQondeMPgDTFEo5w939gSdeTZcfXzQ0wAVhzwDbgH4zPfMzbdoo8Aiu9jkKljXw8IFju0gh+t6iKkGZCIjKT9o7zza1vGfkodhvi2V3VzPdNO28gaxZaRNtmBYUoVnGyR6nXN1Q3CJaVuh5o6GPCOqrhHNbYOFZKBpDiHbxPhVpxHQD2+8yUSGTG7WW75FfZePja5y8d0c/O5L37ZYx4AZAd3KgQYDBT2XCEJGQNawNbfpt diff --git a/tests/integration/rancherostest/test_01_cloud_config.py b/tests/integration/rancherostest/test_01_cloud_config.py index 22d130da..234b519c 100644 --- a/tests/integration/rancherostest/test_01_cloud_config.py +++ b/tests/integration/rancherostest/test_01_cloud_config.py @@ -53,6 +53,33 @@ def test_docker_args(qemu, cloud_config): assert v.find(expected) != -1 +@pytest.mark.timeout(40) +def test_docker_tls_args(qemu, cloud_config): + assert qemu is not None + u.wait_for_ssh(ssh_command) + + subprocess.check_call( + ssh_command + ['sudo', 'ros', 'tls', 'generate', '-s', '--hostname', '10.10.2.120', '-d', '~/.docker'], + stderr=subprocess.STDOUT, universal_newlines=True) + + subprocess.check_call( + ssh_command + ['sudo', 'ros', 'config', 'set', 'rancher.docker.tls', 'true'], + stderr=subprocess.STDOUT, universal_newlines=True) + + subprocess.check_call( + ssh_command + ['sudo', 'system-docker', 'restart', 'docker'], + stderr=subprocess.STDOUT, universal_newlines=True) + u.wait_for_ssh(ssh_command) + + v = subprocess.check_output( + ssh_command + ['sh', '-c', 'ps -ef | grep docker'], + stderr=subprocess.STDOUT, universal_newlines=True) + + expected = string.join(cloud_config['rancher']['docker']['tls_args']) + + assert v.find(expected) != -1 + + @pytest.mark.timeout(40) def test_rancher_network(qemu, cloud_config): assert qemu is not None