mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-08 09:16:22 -03:00
fix(cnpg): hibernation wasn't working because instances cannot be 0
This commit is contained in:
@@ -556,3 +556,18 @@ tests:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG Backup - You need to specify [backups.azure.containerName] or [backups.destinationPath]
|
||||
|
||||
- it: should fail with instances less than 1
|
||||
set:
|
||||
operator:
|
||||
verify:
|
||||
enabled: false
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
instances: 0
|
||||
user: test-user
|
||||
database: test-db
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG - Expected [instances] to be greater than 0, but got [0]
|
||||
|
||||
@@ -20,3 +20,19 @@ tests:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG Pooler - Expected [poolMode] to be one of [session, transaction], but got [invalid]
|
||||
|
||||
- it: should fail with pooler instances less than 1
|
||||
set:
|
||||
operator:
|
||||
verify:
|
||||
enabled: false
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
pooler:
|
||||
instances: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG Pooler - Expected [instances] to be greater than 0, but got [0]
|
||||
|
||||
@@ -39,7 +39,7 @@ tests:
|
||||
isSubset:
|
||||
path: spec
|
||||
content:
|
||||
instances: 0
|
||||
instances: 2
|
||||
|
||||
- it: should set hibernate and 0 instances on stopAll
|
||||
set:
|
||||
@@ -77,7 +77,7 @@ tests:
|
||||
isSubset:
|
||||
path: spec
|
||||
content:
|
||||
instances: 0
|
||||
instances: 2
|
||||
|
||||
- it: should set hibernate and 0 instances on ixChartContext - isStopped
|
||||
set:
|
||||
@@ -118,7 +118,7 @@ tests:
|
||||
isSubset:
|
||||
path: spec
|
||||
content:
|
||||
instances: 0
|
||||
instances: 2
|
||||
|
||||
- it: should not set hibernate and 0 instances on ixChartContext - isStopped
|
||||
set:
|
||||
|
||||
@@ -15,4 +15,4 @@ maintainers:
|
||||
name: common
|
||||
sources: null
|
||||
type: library
|
||||
version: 16.2.7
|
||||
version: 16.2.8
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
{{/* Stop All */}}
|
||||
{{- if or $objectData.hibernate (include "tc.v1.common.lib.util.stopAll" $rootCtx) -}}
|
||||
{{- $hibernation = "on" -}}
|
||||
{{- $instances = 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* General */}}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
{{- $instances := $objectData.pooler.instances | default 2 -}}
|
||||
{{- $hibernation := "off" -}}
|
||||
{{- if or $objectData.hibernate (include "tc.v1.common.lib.util.stopAll" $rootCtx) -}}
|
||||
{{- $instances = 0 -}}
|
||||
{{- $hibernation = "on" -}}
|
||||
{{- end }}
|
||||
---
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (hasKey $objectData "instances") -}}
|
||||
{{- if lt ($objectData.instances | int) 1 -}}
|
||||
{{- fail (printf "CNPG - Expected [instances] to be greater than 0, but got [%d]" ($objectData.instances | int)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (hasKey $objectData "mode") -}}
|
||||
{{- $validModes := (list "standalone" "replica" "recovery") -}}
|
||||
{{- if not (mustHas $objectData.mode $validModes) -}}
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
{{- fail (printf "CNPG Pooler - Expected [type] to be one one of [%s], but got [%s]" (join ", " $validTypes) $objectData.pooler.type) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (hasKey $objectData.pooler "instances") -}}
|
||||
{{- if lt ($objectData.pooler.instances | int) 1 -}}
|
||||
{{- fail (printf "CNPG Pooler - Expected [instances] to be greater than 0, but got [%d]" ($objectData.instances | int)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $validPgModes := (list "session" "transaction") -}}
|
||||
{{- if $objectData.pooler.poolMode -}}
|
||||
{{- if not (mustHas $objectData.pooler.poolMode $validPgModes) -}}
|
||||
|
||||
Reference in New Issue
Block a user