Add integration tests for #1749 (#1766)

* Add integration tests for #1749

Signed-off-by: Matthias Baur <m.baur@syseleven.de>

* Reset extra args on a higher level to only affect subsequent helmfiles

With the implementation before, extra args has been reset after each
helm.exec which leads to problems with multiple charts in a helmfile
since the correct args are only set once in Template(). But Template()
calls helm.exec(template) multiple times.

Signed-off-by: Matthias Baur <m.baur@syseleven.de>

---------

Signed-off-by: Matthias Baur <m.baur@syseleven.de>
This commit is contained in:
Matthias Baur
2024-11-06 08:12:20 +08:00
committed by GitHub
parent 8ee56f13f3
commit d23dc8a9de
7 changed files with 66 additions and 8 deletions
+12
View File
@@ -0,0 +1,12 @@
issue_1749_input_dir="${cases_dir}/issue-1749/input"
helmfile_real="$(pwd)/${helmfile}"
test_start "issue 1749 helmfile.d template --args --dry-run=server"
cd "${issue_1749_input_dir}"
${helmfile_real} template --args --dry-run=server || fail "\"issue 1749 helmfile.d template --args --dry-run=server\" shouldn't fail"
cd -
test_pass "issue 1749 helmfile.d template --args --dry-run=server"
test_start "issue 1749 helmfile.yaml template --args --dry-run=server"
${helmfile_real} template -f "${issue_1749_input_dir}/helmfile-2in1.yaml.gotmpl" --args --dry-run=server || fail "\"issue 1749 helmfile.yaml template --args --dry-run=server\" shouldn't fail"
test_pass "issue 1749 helmfile.yaml template --args --dry-run=server"
@@ -0,0 +1,23 @@
releases:
- name: test1
chart: ../../../charts/raw
values:
- templates:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: {{`{{ .Release.Name }}`}}
data:
foo: {{`{{ (first (lookup "v1" "Namespace" "" "").items).metadata.name }}`}}
- name: test2
chart: ../../../charts/raw
values:
- templates:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: {{`{{ .Release.Name }}`}}
data:
foo: {{`{{ (first (lookup "v1" "Namespace" "" "").items).metadata.name }}`}}
@@ -0,0 +1,12 @@
releases:
- name: test1
chart: ../../../../charts/raw
values:
- templates:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: {{`{{ .Release.Name }}`}}
data:
foo: {{`{{ (first (lookup "v1" "Namespace" "" "").items).metadata.name }}`}}
@@ -0,0 +1,12 @@
releases:
- name: test2
chart: ../../../../charts/raw
values:
- templates:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: {{`{{ .Release.Name }}`}}
data:
foo: {{`{{ (first (lookup "v1" "Namespace" "" "").items).metadata.name }}`}}