another check

This commit is contained in:
Stavros kois
2023-12-07 01:03:15 +02:00
parent 9f0819fd69
commit d4a189acda
2 changed files with 18 additions and 0 deletions

View File

@@ -233,6 +233,21 @@ tests:
- failedTemplate:
errorMessage: Ingress - Expected [hosts.host] to not start with [http://], but got [http://test-host]
- it: should fail with host contain ":"
set:
operator: *operator
ingress:
my-ingress:
enabled: true
primary: true
hosts:
- host: test-host:123
paths:
- path: /test-path
asserts:
- failedTemplate:
errorMessage: Ingress - Expected [hosts.host] to not contain [:], but got [test-host:123]
- it: should fail without paths
set:
operator: *operator

View File

@@ -51,6 +51,9 @@ objectData:
{{- if (hasPrefix "https://" $host) -}}
{{- fail (printf "Ingress - Expected [hosts.host] to not start with [https://], but got [%s]" $host) -}}
{{- end -}}
{{- if (contains ":" $host) -}}
{{- fail (printf "Ingress - Expected [hosts.host] to not contain [:], but got [%s]" $host) -}}
{{- end -}}
{{- if not $h.paths -}}
{{- fail "Ingress - Expected non-empty [hosts.paths]" -}}