summaryrefslogtreecommitdiffstats
path: root/ansible/roles/rke/molecule
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/rke/molecule')
-rw-r--r--ansible/roles/rke/molecule/default/molecule.yml4
-rw-r--r--ansible/roles/rke/molecule/default/playbook.yml6
-rw-r--r--ansible/roles/rke/molecule/default/tests/test_etcd.py (renamed from ansible/roles/rke/molecule/default/tests/test_kubernetes.py)4
-rw-r--r--ansible/roles/rke/molecule/default/tests/test_nodes.py13
4 files changed, 21 insertions, 6 deletions
diff --git a/ansible/roles/rke/molecule/default/molecule.yml b/ansible/roles/rke/molecule/default/molecule.yml
index e8e5ad76..6ae613a9 100644
--- a/ansible/roles/rke/molecule/default/molecule.yml
+++ b/ansible/roles/rke/molecule/default/molecule.yml
@@ -19,7 +19,9 @@ platforms:
container: docker
groups:
- infrastructure
+ - kubernetes-etcd
- kubernetes-control-plane
+ - kubernetes
networks:
- name: rke
purge_networks: true
@@ -37,6 +39,7 @@ platforms:
- /var/lib/docker
groups:
- kubernetes
+ - kubernetes-node
networks:
- name: rke
purge_networks: true
@@ -54,6 +57,7 @@ platforms:
- /var/lib/docker
groups:
- kubernetes
+ - kubernetes-node
networks:
- name: rke
purge_networks: true
diff --git a/ansible/roles/rke/molecule/default/playbook.yml b/ansible/roles/rke/molecule/default/playbook.yml
index 09dbfb8e..fab7a0d0 100644
--- a/ansible/roles/rke/molecule/default/playbook.yml
+++ b/ansible/roles/rke/molecule/default/playbook.yml
@@ -13,10 +13,8 @@
vars:
mode: config
-- name: Prepare kubernetes nodes (RKE)
- hosts:
- - kubernetes
- - kubernetes-control-plane
+- name: Prepare kubernetes hosts (RKE)
+ hosts: kubernetes
roles:
- role: rke
vars:
diff --git a/ansible/roles/rke/molecule/default/tests/test_kubernetes.py b/ansible/roles/rke/molecule/default/tests/test_etcd.py
index 887494fa..0f4b6f12 100644
--- a/ansible/roles/rke/molecule/default/tests/test_kubernetes.py
+++ b/ansible/roles/rke/molecule/default/tests/test_etcd.py
@@ -4,10 +4,10 @@ import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
- os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('kubernetes')
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('kubernetes-etcd')
@pytest.mark.parametrize('container_name', [
- 'etcd', 'kubelet', 'kube-proxy'])
+ 'etcd'])
def test_container_running(host, container_name):
assert host.docker(container_name).is_running
diff --git a/ansible/roles/rke/molecule/default/tests/test_nodes.py b/ansible/roles/rke/molecule/default/tests/test_nodes.py
new file mode 100644
index 00000000..60413018
--- /dev/null
+++ b/ansible/roles/rke/molecule/default/tests/test_nodes.py
@@ -0,0 +1,13 @@
+import os
+import pytest
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('kubernetes-node')
+
+
+@pytest.mark.parametrize('container_name', [
+ 'kubelet', 'kube-proxy'])
+def test_container_running(host, container_name):
+ assert host.docker(container_name).is_running