add an error for edge case

This commit is contained in:
Stavros kois
2023-02-13 19:22:15 +02:00
parent 37d8562795
commit 349f05a587
2 changed files with 13 additions and 2 deletions
@@ -48,6 +48,17 @@ tests:
- failedTemplate:
errorMessage: Workload - Expected <type> to be one of [Deployment, StatefulSet, DaemonSet, Job, CronJob], but got [not-valid-type]
- it: should fail without podSpec
set:
workload:
workload-name:
enabled: true
primary: true
type: Deployment
asserts:
- failedTemplate:
errorMessage: Workload - Expected <podSpec> key to exist
- it: should fail without primary enabled workload
set:
workload:
@@ -63,7 +74,7 @@ tests:
podSpec: {}
asserts:
- failedTemplate:
errorMessage: Workload - At least one enabled workload must be primary
errorMessage: Workload - One enabled workload must be primary
- it: should fail more than one primary enabled workload
set:
@@ -33,7 +33,7 @@
{{/* Set the podSpec so it doesn't fail on nil pointer */}}
{{- if not (hasKey $objectData "podSpec") -}}
{{ $_ := set $objectData "podSpec" dict }}
{{- fail "Workload - Expeced <podSpec> key to exist" -}}
{{- end -}}
{{/* Call class to create the object */}}