mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-06 13:02:37 +00:00
Return diff in helm check mode (#290)
Return diff in helm check mode When the helm module is executed in check mode with the helm diff plugin installed, it now returns the diff. SUMMARY When the helm module is executed in check mode with the helm diff plugin installed, it now returns the diff. COMPONENT NAME helm ADDITIONAL INFORMATION Reviewed-by: Abhijeet Kasurde <None> Reviewed-by: Fabrice <None> Reviewed-by: Mike Graves <mgraves@redhat.com> Reviewed-by: None <None>
This commit is contained in:
@@ -40,6 +40,33 @@
|
||||
data:
|
||||
foo: {{ .Values.foo | default "bar" }}
|
||||
|
||||
- name: Test helm diff in check mode
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: test-chart
|
||||
namespace: "{{ helm_namespace }}"
|
||||
chart_ref: "{{ test_chart_ref }}"
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: diff_result
|
||||
|
||||
- name: Check if helm diff check is correct
|
||||
vars:
|
||||
expected: "\u001b[0;33mhelm, test-chart-another-configmap, ConfigMap (v1) has been added:\u001b[0m\n\
|
||||
\u001b[0;31m- \u001b[0m\n\
|
||||
\u001b[0;32m+ # Source: test-chart/templates/anothermap.yaml\u001b[0m\n\
|
||||
\u001b[0;32m+ # BEGIN ANSIBLE MANAGED BLOCK\u001b[0m\n\
|
||||
\u001b[0;32m+ apiVersion: v1\u001b[0m\n\
|
||||
\u001b[0;32m+ kind: ConfigMap\u001b[0m\n\
|
||||
\u001b[0;32m+ metadata:\u001b[0m\n\
|
||||
\u001b[0;32m+ name: test-chart-another-configmap\u001b[0m\n\
|
||||
\u001b[0;32m+ data:\u001b[0m\n\
|
||||
\u001b[0;32m+ foo: bar\u001b[0m\n\
|
||||
\u001b[0;32m+ # END ANSIBLE MANAGED BLOCK\u001b[0m"
|
||||
assert:
|
||||
that:
|
||||
- expected == diff_result.diff.prepared
|
||||
|
||||
- name: Upgrade local chart with modifications
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
@@ -52,6 +79,21 @@
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
- name: No diff in check mode when no change
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: test-chart
|
||||
namespace: "{{ helm_namespace }}"
|
||||
chart_ref: "{{ test_chart_ref }}"
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: diff_result
|
||||
|
||||
- name: Check if no diff in check mode when no change
|
||||
assert:
|
||||
that:
|
||||
- '"diff" not in diff_result'
|
||||
|
||||
- name: Upgrade modified local chart idempotency check
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
|
||||
Reference in New Issue
Block a user