mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-03 02:49:15 -03:00
make sure data is correct
This commit is contained in:
@@ -168,6 +168,32 @@ tests:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG Recovery - Expected [recovery.revision] to be a string, got [float64]
|
||||
|
||||
- it: should fail with pgVersion not a string
|
||||
set:
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
mode: standalone
|
||||
pgVersion: 5
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG - Expected [pgVersion] to be a string, but got [float64]
|
||||
|
||||
- it: should fail with invalid pgVersion
|
||||
set:
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
mode: standalone
|
||||
pgVersion: invalid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG - Expected [pgVersion] to be one of [15, 16], but got [invalid]
|
||||
|
||||
- it: should fail with invalid recovery method
|
||||
set:
|
||||
cnpg:
|
||||
|
||||
@@ -8,10 +8,15 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (hasKey $objectData "version") -}}
|
||||
{{- if $objectData.version -}}
|
||||
{{- if not (kindIs "string" $objectData.pgVersion) -}}
|
||||
{{/* We must ensure that this is a string, as it is used in image selector that require a string */}}
|
||||
{{- fail (printf "CNPG - Expected [pgVersion] to be a string, but got [%s]" (kindOf $objectData.pgVersion)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $validVersions := (list "15" "16") -}}
|
||||
{{- if not (mustHas ( toString $objectData.version ) $validVersions) -}}
|
||||
{{- fail (printf "CNPG - Expected [version] to be one of [%s], but got [%s]" (join ", " $validVersions) $objectData.version) -}}
|
||||
{{- if not (mustHas $objectData.pgVersion $validVersions) -}}
|
||||
{{- fail (printf "CNPG - Expected [pgVersion] to be one of [%s], but got [%s]" (join ", " $validVersions) $objectData.pgVersion) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user