This commit is contained in:
Stavros Kois
2023-12-22 13:35:20 +02:00
committed by GitHub
parent a5a846348e
commit fc80bc70d3
2 changed files with 33 additions and 0 deletions

View File

@@ -62,6 +62,11 @@ tests:
custom:
some-key: some-value
some-other-key: some-other-value
customkv:
- key: some-key-slice
value: some-value-slice
- key: some-other-key-slice
value: some-other-value-slice
hosts: &hosts
- host: test-host
paths:
@@ -106,6 +111,8 @@ tests:
gethomepage.dev/pod-selector: pod.name in (main,other)
gethomepage.dev/widget.some-key: some-value
gethomepage.dev/widget.some-other-key: some-other-value
gethomepage.dev/widget.some-key-slice: some-value-slice
gethomepage.dev/widget.some-other-key-slice: some-other-value-slice
- documentIndex: *otherIngressDoc
equal:
path: metadata.name
@@ -154,3 +161,23 @@ tests:
asserts:
- failedTemplate:
errorMessage: Ingress - Expected [integrations.homepage.widget.custom] to be a [map], but got [string]
- it: should fail with customkv widget not a slice
set:
operator: *operator
service: *service
ingress:
my-ingress1:
enabled: true
primary: true
integrations:
traefik:
enabled: false
homepage:
enabled: true
widget:
customkv: "not a slice"
hosts: *hosts
asserts:
- failedTemplate:
errorMessage: Ingress - Expected [integrations.homepage.widget.customkv] to be a [slice], but got [string]

View File

@@ -75,4 +75,10 @@
{{- fail (printf "Ingress - Expected [integrations.homepage.widget.custom] to be a [map], but got [%s]" (kindOf $homepage.widget.custom)) -}}
{{- end -}}
{{- end -}}
{{- if $homepage.widget.customkv -}}
{{- if not (kindIs "slice" $homepage.widget.customkv) -}}
{{- fail (printf "Ingress - Expected [integrations.homepage.widget.customkv] to be a [slice], but got [%s]" (kindOf $homepage.widget.customkv)) -}}
{{- end -}}
{{- end -}}
{{- end -}}