From 4771fdfb767164c15ec80d68163c9c06e08ec184 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Thu, 27 Jun 2024 13:59:10 +0200 Subject: [PATCH] OZG-5958 update xta dictToList function and unittests --- xta-adapter/src/main/helm/templates/_helpers.tpl | 5 +++-- .../src/test/helm/xta_adapter_cronjob_env_test.yaml | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/xta-adapter/src/main/helm/templates/_helpers.tpl b/xta-adapter/src/main/helm/templates/_helpers.tpl index dbcecb22a..5f233e14c 100644 --- a/xta-adapter/src/main/helm/templates/_helpers.tpl +++ b/xta-adapter/src/main/helm/templates/_helpers.tpl @@ -71,8 +71,9 @@ helm.sh/chart: {{ include "app.chart" . }} {{- end -}} {{- define "app.dictToList" -}} +{{- $customList := list -}} {{- range $key, $value := . -}} -- name: {{ $key }} - value: {{ $value }} +{{- $customList = append $customList (dict "name" $key "value" $value) }} {{- end -}} +{{- $customList | toYaml -}} {{- end -}} \ No newline at end of file diff --git a/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml b/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml index 0a5f6345d..30ad85fc1 100644 --- a/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml +++ b/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml @@ -160,22 +160,35 @@ tests: env.customList: - name: my_test_environment_name value: "A test value" + - name: test_environment + value: "B test value" asserts: - contains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: name: my_test_environment_name value: "A test value" + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: test_environment + value: "B test value" - it: check customList as dict set: env.customList: my_test_environment_name: "A test value" + test_environment: "B test value" asserts: - contains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: name: my_test_environment_name value: "A test value" + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: test_environment + value: "B test value" - it: check customList test value is not set by default asserts: -- GitLab