mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-14 05:22:08 +00:00
Add integration test to check handling of module_defaults (#296)
Add integration test to check handling of module_defaults SUMMARY Add integration test to make sure that module_defaults are handled correctly in tasks. Related to #126. ISSUE TYPE Bugfix Pull Request Reviewed-by: Mike Graves <mgraves@redhat.com> Reviewed-by: None <None>
This commit is contained in:
@@ -9,7 +9,6 @@ action_groups:
|
|||||||
k8s:
|
k8s:
|
||||||
- k8s
|
- k8s
|
||||||
- k8s_exec
|
- k8s_exec
|
||||||
- k8s_facts
|
|
||||||
- k8s_info
|
- k8s_info
|
||||||
- k8s_log
|
- k8s_log
|
||||||
- k8s_scale
|
- k8s_scale
|
||||||
|
|||||||
@@ -426,6 +426,49 @@
|
|||||||
that:
|
that:
|
||||||
- result.resources[0].data.testkey == "{{ cmap_data.stdout | b64encode }}"
|
- result.resources[0].data.testkey == "{{ cmap_data.stdout | b64encode }}"
|
||||||
|
|
||||||
|
# test setting module defaults for kubernetes.core.k8s_info
|
||||||
|
- block:
|
||||||
|
- name: Create a namespace
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
name: test-namespace-module-defaults
|
||||||
|
kind: Namespace
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- name: Create a ConfigMap
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
kind: ConfigMap
|
||||||
|
name: test-configmap-1
|
||||||
|
definition:
|
||||||
|
data:
|
||||||
|
key1: value1
|
||||||
|
|
||||||
|
- name: Create another ConfigMap
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
kind: ConfigMap
|
||||||
|
name: test-configmap-2
|
||||||
|
definition:
|
||||||
|
data:
|
||||||
|
key2: value2
|
||||||
|
|
||||||
|
- name: Get list of all ConfigMaps in namespace specified in module_defaults
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
kind: ConfigMap
|
||||||
|
register: configmap_info
|
||||||
|
|
||||||
|
- name: assert that the ConfigMaps are created in and info is retrieved for namespace specified in module_defaults
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- configmap_info.resources[1].metadata.name == "test-configmap-1"
|
||||||
|
- configmap_info.resources[1].metadata.namespace == "test-namespace-module-defaults"
|
||||||
|
- configmap_info.resources[2].metadata.name == "test-configmap-2"
|
||||||
|
- configmap_info.resources[2].metadata.namespace == "test-namespace-module-defaults"
|
||||||
|
|
||||||
|
module_defaults:
|
||||||
|
group/kubernetes.core.k8s:
|
||||||
|
namespace: test-namespace-module-defaults
|
||||||
|
|
||||||
|
when: ansible_version.full is version("2.12", ">=")
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete all namespaces
|
- name: Delete all namespaces
|
||||||
k8s:
|
k8s:
|
||||||
@@ -459,4 +502,8 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
metadata:
|
metadata:
|
||||||
name: testing6
|
name: testing6
|
||||||
|
- kind: Namespace
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: test-namespace-module-defaults
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|||||||
Reference in New Issue
Block a user