@@ -28,7 +28,6 @@ metadata:
2828items: []
2929EOF
3030)
31- HELM_ERROR_SNIPPET=" Helm template command results in error"
3231CHARTS_SRC=" charts/bitnami"
3332
3433# ###########################
@@ -177,48 +176,6 @@ assert_dir_exists payments-dev
177176assert_dir_exists payments-prod
178177grep -q allowPrivilegeEscalation podsecuritypolicy_psp.yaml
179178
180- helm_testcase " docker_helm_template_undefined_args"
181- docker run -u " $( id -u) " -v " $( pwd) /${CHARTS_SRC} " :/source gcr.io/kpt-functions/helm-template:" ${TAG} " -i /dev/null 2> err.txt || true
182- assert_contains_string err.txt " Error: functionConfig expected, instead undefined"
183-
184- helm_testcase " docker_helm_template_empty_fc"
185- cat > fc.yaml << EOF
186- apiVersion: v1
187- kind: ConfigMap
188- metadata:
189- name: empty-config
190- annotations:
191- config.k8s.io/function: |
192- container:
193- image: gcr.io/kpt-functions/helm-template
194- config.kubernetes.io/local-config: "true"
195- data:
196- EOF
197- docker run -u " $( id -u) " -v " $( pwd) " :/source gcr.io/kpt-functions/helm-template:" ${TAG} " -i /dev/null -f /source/fc.yaml 2> err.txt || true
198- assert_contains_string err.txt " Error: functionConfig expected to contain data, instead empty"
199-
200- helm_testcase " docker_helm_template_invalid_fc"
201- cat > fc.yaml << EOF
202- apiVersion: v1
203- kind: ConfigMap
204- metadata:
205- name: invalid-config
206- annotations:
207- config.k8s.io/function: |
208- container:
209- image: gcr.io/kpt-functions/helm-template
210- config.kubernetes.io/local-config: "true"
211- data:
212- name: invalid-fc
213- chart_path: /path/to/helm/chart
214- EOF
215- docker run -u " $( id -u) " -v " $( pwd) " :/source gcr.io/kpt-functions/helm-template:" ${TAG} " -i /dev/null -f /source/fc.yaml > out.yaml || true
216- assert_contains_string out.yaml " ${HELM_ERROR_SNIPPET} "
217-
218- helm_testcase " docker_helm_template_too_few_args"
219- docker run -u " $( id -u) " -v " $( pwd) /${CHARTS_SRC} " :/source gcr.io/kpt-functions/helm-template:" ${TAG} " -i /dev/null -d name=too-few-args > out.yaml || true
220- assert_contains_string out.yaml " ${HELM_ERROR_SNIPPET} "
221-
222179helm_testcase " docker_helm_template_expected_args"
223180docker run -u " $( id -u) " -v " $( pwd) /${CHARTS_SRC} " :/source gcr.io/kpt-functions/helm-template:" ${TAG} " -i /dev/null -d name=expected-args -d chart_path=/source/redis > out.yaml
224181assert_contains_string out.yaml " expected-args"
0 commit comments