mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-03 01:04:18 -03:00
more tests
This commit is contained in:
@@ -67,6 +67,12 @@ tests:
|
||||
|
||||
- it: should respect changed fallbackDefaults
|
||||
set:
|
||||
postgres15Image:
|
||||
repository: ghcr.io/cloudnative-pg/postgresql
|
||||
tag: "15.6"
|
||||
global:
|
||||
fallbackDefaults:
|
||||
pgVersion: "15"
|
||||
fallbackDefaults:
|
||||
vctAccessModes:
|
||||
- ReadWriteMany
|
||||
@@ -91,6 +97,7 @@ tests:
|
||||
isSubset:
|
||||
path: spec
|
||||
content:
|
||||
imageName: ghcr.io/cloudnative-pg/postgresql:15.6
|
||||
storage:
|
||||
pvcTemplate:
|
||||
accessModes:
|
||||
@@ -108,6 +115,61 @@ tests:
|
||||
requests:
|
||||
storage: 100Gi
|
||||
|
||||
- it: should generate correct imageName with changed type and pgVersion
|
||||
set:
|
||||
postgresVectors15Image:
|
||||
repository: ghcr.io/tensorchord/cloudnative-pgvecto.rs
|
||||
tag: "15.6-v0.2.1"
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
pgVersion: "15"
|
||||
type: vectors
|
||||
asserts:
|
||||
- documentIndex: &clusterDoc 1
|
||||
isKind:
|
||||
of: Cluster
|
||||
- documentIndex: *clusterDoc
|
||||
isAPIVersion:
|
||||
of: postgresql.cnpg.io/v1
|
||||
- documentIndex: *clusterDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: test-release-name-common-test-cnpg-my-pg
|
||||
- documentIndex: *clusterDoc
|
||||
equal:
|
||||
path: spec.imageName
|
||||
value: ghcr.io/tensorchord/cloudnative-pgvecto.rs:15.6-v0.2.1
|
||||
|
||||
- it: should generate correct imageName with changed pgVersion
|
||||
set:
|
||||
postgres15Image:
|
||||
repository: ghcr.io/cloudnative-pg/postgresql
|
||||
tag: "15.6"
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
pgVersion: "15"
|
||||
asserts:
|
||||
- documentIndex: &clusterDoc 1
|
||||
isKind:
|
||||
of: Cluster
|
||||
- documentIndex: *clusterDoc
|
||||
isAPIVersion:
|
||||
of: postgresql.cnpg.io/v1
|
||||
- documentIndex: *clusterDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: test-release-name-common-test-cnpg-my-pg
|
||||
- documentIndex: *clusterDoc
|
||||
equal:
|
||||
path: spec.imageName
|
||||
value: ghcr.io/cloudnative-pg/postgresql:15.6
|
||||
|
||||
- it: should override options
|
||||
set:
|
||||
ext1: some-extension
|
||||
|
||||
@@ -71,7 +71,7 @@ tests:
|
||||
type: invalid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: CNPG Cluster - Expected [type] to be one of [postgres, postgis, timescaledb], but got [invalid]
|
||||
errorMessage: CNPG Cluster - Expected [type] to be one of [postgres, postgis, timescaledb, vectors], but got [invalid]
|
||||
|
||||
- it: should fail with invalid log level
|
||||
set:
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
suite: cnpg pgVersion configmap test
|
||||
templates:
|
||||
- common.yaml
|
||||
release:
|
||||
name: test-release-name
|
||||
namespace: test-release-namespace
|
||||
tests:
|
||||
- it: should generate correct configmap
|
||||
set:
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
asserts:
|
||||
- documentIndex: &cmDoc 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *cmDoc
|
||||
isAPIVersion:
|
||||
of: v1
|
||||
- documentIndex: *cmDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: test-release-name-common-test-cnpg-my-pg-pgversion
|
||||
- documentIndex: *cmDoc
|
||||
equal:
|
||||
path: data.version
|
||||
value: "16"
|
||||
|
||||
- it: should generate correct configmap with changed defaults
|
||||
set:
|
||||
global:
|
||||
fallbackDefaults:
|
||||
pgVersion: "15"
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
asserts:
|
||||
- documentIndex: &cmDoc 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *cmDoc
|
||||
isAPIVersion:
|
||||
of: v1
|
||||
- documentIndex: *cmDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: test-release-name-common-test-cnpg-my-pg-pgversion
|
||||
- documentIndex: *cmDoc
|
||||
equal:
|
||||
path: data.version
|
||||
value: "15"
|
||||
|
||||
- it: should generate correct configmap with changed at cnpg level
|
||||
set:
|
||||
cnpg:
|
||||
my-pg:
|
||||
enabled: true
|
||||
user: test-user
|
||||
database: test-db
|
||||
pgVersion: "15"
|
||||
asserts:
|
||||
- documentIndex: &cmDoc 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *cmDoc
|
||||
isAPIVersion:
|
||||
of: v1
|
||||
- documentIndex: *cmDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: test-release-name-common-test-cnpg-my-pg-pgversion
|
||||
- documentIndex: *cmDoc
|
||||
equal:
|
||||
path: data.version
|
||||
value: "15"
|
||||
@@ -39,7 +39,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- if (hasKey $objectData "type") -}}
|
||||
{{- $validTypes := (list "postgres" "postgis" "timescaledb") -}}
|
||||
{{- $validTypes := (list "postgres" "postgis" "timescaledb" "vectors") -}}
|
||||
{{- if not (mustHas $objectData.type $validTypes) -}}
|
||||
{{- fail (printf "CNPG Cluster - Expected [type] to be one of [%s], but got [%s]" (join ", " $validTypes) $objectData.type) -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
{{- with (lookup "v1" "ConfigMap" $.Release.Namespace (printf "%s-%s" $fullname $versionConfigMapName)) -}}
|
||||
{{/* If a different version is set and upgrade is enabled, upgrade */}}
|
||||
{{- if and (ne $pgVersion .data.version) $objectData.upgradeMajor -}}
|
||||
{{/* TODO: maybe check that the version is newer and not older? */}}
|
||||
{{/* TODO: actually handle postgres version updates here */}}
|
||||
{{- else -}}
|
||||
{{- $pgVersion = .data.version -}}
|
||||
|
||||
@@ -8,10 +8,10 @@ global:
|
||||
# TODO: Currently some objects do not support this
|
||||
namespace: ""
|
||||
fallbackDefaults:
|
||||
# -- Define a postgresql version for CNPG
|
||||
# will be used for all CNPG objects
|
||||
# Can be overruled per CNPG objects
|
||||
pgVersion: 16
|
||||
# -- Define a postgresql version for CNPG
|
||||
# will be used for all CNPG objects
|
||||
# Can be overruled per CNPG objects
|
||||
pgVersion: 16
|
||||
metallb:
|
||||
# -- Adds metalLB annotations to services
|
||||
addServiceAnnotations: true
|
||||
@@ -578,13 +578,14 @@ ingress:
|
||||
annotations: {}
|
||||
# -- Set the ingressClass that is used for this ingress.
|
||||
# Requires Kubernetes >=1.19
|
||||
ingressClassName: ""
|
||||
ingressClassName: ""
|
||||
# Defaults to primary service and primary port
|
||||
# targetSelector:
|
||||
# # service: port
|
||||
# main: main
|
||||
## Configure the hosts for the ingress
|
||||
hosts: []
|
||||
hosts:
|
||||
[]
|
||||
# - # -- Host address. Helm template can be passed.
|
||||
# host: chart-example.local
|
||||
# ## Configure the paths for the host
|
||||
@@ -625,7 +626,8 @@ ingress:
|
||||
# # Optional, by default will try to
|
||||
# # "lookup" the namespace based on the name
|
||||
# namespace: ""
|
||||
middlewares: []
|
||||
middlewares:
|
||||
[]
|
||||
# - name: my-middleware
|
||||
# # Optional, by default will try to
|
||||
# # "lookup" the namespace based on the name
|
||||
@@ -651,7 +653,8 @@ ingress:
|
||||
# - key: some key
|
||||
# value: some value
|
||||
|
||||
certificate: {}
|
||||
certificate:
|
||||
{}
|
||||
# main:
|
||||
# enabled: false
|
||||
# certificateIssuer: someissuer
|
||||
@@ -681,28 +684,28 @@ route:
|
||||
labels: {}
|
||||
# -- Configure the resource the route attaches to.
|
||||
parentRefs:
|
||||
- # Group of the referent resource.
|
||||
group: gateway.networking.k8s.io
|
||||
# Kind of the referent resource.
|
||||
kind: Gateway
|
||||
# Name of the referent resource
|
||||
name:
|
||||
# Namespace of the referent resource
|
||||
namespace:
|
||||
# Name of the section within the target resource.
|
||||
sectionName:
|
||||
- # Group of the referent resource.
|
||||
group: gateway.networking.k8s.io
|
||||
# Kind of the referent resource.
|
||||
kind: Gateway
|
||||
# Name of the referent resource
|
||||
name:
|
||||
# Namespace of the referent resource
|
||||
namespace:
|
||||
# Name of the section within the target resource.
|
||||
sectionName:
|
||||
# -- Host addresses
|
||||
hostnames: []
|
||||
# -- Configure rules for routing. Defaults to the primary service.
|
||||
rules:
|
||||
- # -- Configure backends where matching requests should be sent.
|
||||
- # -- Configure backends where matching requests should be sent.
|
||||
backendRefs:
|
||||
- group: ""
|
||||
kind: Service
|
||||
name:
|
||||
namespace:
|
||||
port:
|
||||
weight: 1
|
||||
- group: ""
|
||||
kind: Service
|
||||
name:
|
||||
namespace:
|
||||
port:
|
||||
weight: 1
|
||||
## Configure conditions used for matching incoming requests. Only for HTTPRoutes
|
||||
matches:
|
||||
- path:
|
||||
@@ -878,7 +881,8 @@ metrics:
|
||||
honorLabels: false
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
groups: {}
|
||||
groups:
|
||||
{}
|
||||
# somegroup:
|
||||
# # list of rules
|
||||
# rules: []
|
||||
@@ -958,12 +962,14 @@ addons:
|
||||
|
||||
# -- All variables specified here will be added to the vpn sidecar container
|
||||
# See the documentation of the VPN image for all config values
|
||||
env: {}
|
||||
env:
|
||||
{}
|
||||
# TZ: UTC
|
||||
|
||||
# -- All variables specified here will be added to the vpn sidecar container
|
||||
# See the documentation of the VPN image for all config values
|
||||
envList: []
|
||||
envList:
|
||||
[]
|
||||
# - name: someenv
|
||||
# value: somevalue
|
||||
|
||||
@@ -1011,7 +1017,8 @@ addons:
|
||||
|
||||
# -- All variables specified here will be added to the codeserver sidecar container
|
||||
# See the documentation of the codeserver image for all config values
|
||||
envList: []
|
||||
envList:
|
||||
[]
|
||||
# - name: someenv
|
||||
# value: somevalue
|
||||
# -- Set codeserver command line arguments.
|
||||
@@ -1042,7 +1049,8 @@ addons:
|
||||
ingress:
|
||||
# -- Enable an ingress for the code-server add-on.
|
||||
enabled: false
|
||||
annotations: {}
|
||||
annotations:
|
||||
{}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
labels: {}
|
||||
hosts:
|
||||
@@ -1155,7 +1163,8 @@ cnpg:
|
||||
# BootstrapInitDB is the configuration of the bootstrap process when initdb is used
|
||||
# See: https://cloudnative-pg.io/documentation/current/bootstrap/
|
||||
# See: https://cloudnative-pg.io/documentation/current/api_reference/#bootstrapinitdb
|
||||
initdb: {}
|
||||
initdb:
|
||||
{}
|
||||
# postInitSQL:
|
||||
# - CREATE EXTENSION IF NOT EXISTS vector;
|
||||
# postInitApplicationSQL:
|
||||
@@ -1164,7 +1173,8 @@ cnpg:
|
||||
monitoring:
|
||||
enablePodMonitor: true
|
||||
disableDefaultQueries: false
|
||||
customQueries: []
|
||||
customQueries:
|
||||
[]
|
||||
# - name: "pg_cache_hit_ratio"
|
||||
# expandObjectName: true
|
||||
# key: "custom-key" (defaults to "custom-queries")
|
||||
@@ -1284,7 +1294,8 @@ cnpg:
|
||||
retentionPolicy: "30d"
|
||||
|
||||
# - Manual list of backups
|
||||
manualBackups: []
|
||||
manualBackups:
|
||||
[]
|
||||
# - name: today
|
||||
# labels: {}
|
||||
# annotations: {}
|
||||
|
||||
Reference in New Issue
Block a user