From 1ec19b0598382aa45258ed630ee26cba4fb3a7e5 Mon Sep 17 00:00:00 2001 From: Michal Zegan Date: Tue, 30 Apr 2019 14:52:13 +0200 Subject: Add molecule tests for rke role This change adds molecule tests for the rke role, and modifies the rke role itself to be more idempotent/to pass linter. Note that this molecule test case uses a separate role to install docker in containers, that runs docker daemon inside of them instead of using host docker. Issue-ID: OOM-1778 Change-Id: I875f3ff2ab961e5428acee5a02287a8d2d6e9969 Signed-off-by: Michal Zegan --- .../roles/rke/molecule/default/tests/test_controlplane.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ansible/roles/rke/molecule/default/tests/test_controlplane.py (limited to 'ansible/roles/rke/molecule/default/tests/test_controlplane.py') diff --git a/ansible/roles/rke/molecule/default/tests/test_controlplane.py b/ansible/roles/rke/molecule/default/tests/test_controlplane.py new file mode 100644 index 00000000..0bfbca2d --- /dev/null +++ b/ansible/roles/rke/molecule/default/tests/test_controlplane.py @@ -0,0 +1,14 @@ +import os +import pytest + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts( + 'kubernetes-control-plane') + + +@pytest.mark.parametrize('container_name', [ + 'kube-apiserver', 'kube-controller-manager', 'kube-scheduler', 'kubelet']) +def test_container_running(host, container_name): + assert host.docker(container_name).is_running -- cgit 1.2.3-korg