Skip to content
Snippets Groups Projects
Commit 9eb5c378 authored by OZG-Cloud Team's avatar OZG-Cloud Team
Browse files

Merge pull request 'ozg-5100 fix dict to list' (#124) from ozg-5100-customlist-fix into master

parents 219a29f3 39847cdc
No related branches found
No related tags found
No related merge requests found
...@@ -101,8 +101,9 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} ...@@ -101,8 +101,9 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end -}} {{- end -}}
{{- define "app.dictToList" -}} {{- define "app.dictToList" -}}
{{- $customList := list -}}
{{- range $key, $value := . -}} {{- range $key, $value := . -}}
- name: {{ $key }} {{- $customList = append $customList (dict "name" $key "value" $value) }}
value: {{ $value }}
{{- end -}} {{- end -}}
{{- $customList | toYaml -}}
{{- end -}} {{- end -}}
\ No newline at end of file
...@@ -34,22 +34,35 @@ tests: ...@@ -34,22 +34,35 @@ tests:
env.customList: env.customList:
- name: my_test_environment_name - name: my_test_environment_name
value: "A test value" value: "A test value"
- name: test_environment
value: "B test value"
asserts: asserts:
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: my_test_environment_name name: my_test_environment_name
value: "A test value" value: "A test value"
- contains:
path: spec.template.spec.containers[0].env
content:
name: test_environment
value: "B test value"
- it: check customList as dict - it: check customList as dict
set: set:
env.customList: env.customList:
my_test_environment_name: "A test value" my_test_environment_name: "A test value"
test_environment: "B test value"
asserts: asserts:
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: my_test_environment_name name: my_test_environment_name
value: "A test value" value: "A test value"
- contains:
path: spec.template.spec.containers[0].env
content:
name: test_environment
value: "B test value"
- it: check customList test value is not set by default - it: check customList test value is not set by default
asserts: asserts:
- notContains: - notContains:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment