From 9c80a5756c8600d43266a7ba43a971d54288a8cd Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Wed, 12 Feb 2020 12:40:02 +0000 Subject: [PATCH] Integrate the integration test --- molecule/default/tasks/full.yml | 1 + .../kubernetes/tasks/test_k8s_exec.yml | 30 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/molecule/default/tasks/full.yml b/molecule/default/tasks/full.yml index b99f0d3a..d6216e48 100644 --- a/molecule/default/tasks/full.yml +++ b/molecule/default/tasks/full.yml @@ -326,6 +326,7 @@ register: k8s_info_testing6 failed_when: not k8s_info_testing6.resources or k8s_info_testing6.resources[0].status.phase != "Active" + - include_tasks: test_k8s_exec.yml - include_tasks: crd.yml - include_tasks: lists.yml - include_tasks: append_hash.yml diff --git a/tests/integration/targets/kubernetes/tasks/test_k8s_exec.yml b/tests/integration/targets/kubernetes/tasks/test_k8s_exec.yml index cc467a47..99ec5913 100644 --- a/tests/integration/targets/kubernetes/tasks/test_k8s_exec.yml +++ b/tests/integration/targets/kubernetes/tasks/test_k8s_exec.yml @@ -2,24 +2,26 @@ - vars: ns: k8s-exec pod: sleep-pod + pod_def: + apiVersion: v1 + kind: Pod + metadata: + name: "{{ pod }}" + namespace: "{{ ns }}" + spec: + containers: + - image: busybox + command: ["sleep", "infinity"] + block: - - name: ensure that k8s-log namespace exists + - name: Ensure that k8s-log namespace exists k8s: kind: Namespace name: "{{ ns }}" - name: Create a pod k8s: - definition: - apiVersion: v1 - kind: Pod - metadata: - name: "{{ pod }}" - namespace: "{{ ns }}" - spec: - containers: - - image: busybox - command: ["sleep", "infinity"] + definition: "{{ pod_def }}" wait: yes wait_sleep: 1 wait_timeout: 30 @@ -39,3 +41,9 @@ assert: that: - "'nameserver' in output.stdout" + + - name: Cleanup namespace + k8s: + kind: Namespace + name: "{{ ns }}" + state: absent