another case

This commit is contained in:
Stavros kois
2023-02-10 16:12:46 +02:00
parent b297437676
commit cfed7dd3ef
2 changed files with 29 additions and 0 deletions

View File

@@ -217,6 +217,29 @@ tests:
- failedTemplate:
errorMessage: Container - Expected non-empty <lifecycle> <port> on [http] type
- it: should fail with path not starting with / on http lifecycle type
set:
image: *image
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: image
lifecycle:
preStop:
type: http
port: 80
path: "api/v1"
asserts:
- failedTemplate:
errorMessage: Container - Expected <path> to start with a forward slash [/] on <http> type
- it: should fail with empty value on httpHeaders on http lifecycle type
set:
image: *image

View File

@@ -15,9 +15,15 @@ objectData: The object data to be used to render the container.
{{- if kindIs "string" $port -}}
{{- $port = tpl $port $rootCtx -}}
{{- end -}}
{{- with $objectData.path -}}
{{- $path = tpl . $rootCtx -}}
{{- end -}}
{{- if not (hasPrefix "/" $path) -}}
{{- fail "Container - Expected <path> to start with a forward slash [/] on <http> type" -}}
{{- end -}}
{{- with $objectData.scheme -}}
{{- $scheme = tpl . $rootCtx -}}
{{- end }}