The `templates/gitea` subdirectory did not group anything meaningful, since every template of this chart belongs to Gitea. It only duplicated the chart name in every path and forced the unit tests to spell out `templates/gitea/<name>.yaml`, while `_helpers.tpl` and `NOTES.txt` already lived directly in `templates`. All templates now live in `templates`, which matches the layout of the bundled sub-charts and the Helm defaults. The checksum helper in `templates/_secrets.tpl` built its include path from `$root.Template.BasePath` and therefore carried the subdirectory in a `printf` format string instead of a literal path. Without adjusting it the chart failed to render with "no template gitea/templates/gitea/secret_config.yaml associated with template gotpl". Co-authored-by: Copilot <copilot@github.com>
139 lines
4.8 KiB
YAML
139 lines
4.8 KiB
YAML
suite: Dependency checks | Customization integrity | postgresql-ha
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
set:
|
|
postgresql:
|
|
enabled: false
|
|
postgresql-ha:
|
|
enabled: true
|
|
global:
|
|
postgresql:
|
|
database: gitea-database
|
|
password: gitea-password
|
|
username: gitea-username
|
|
postgresql:
|
|
repmgrPassword: custom-password-repmgr
|
|
postgresPassword: custom-password-postgres
|
|
password: custom-password-overwritten-by-global-postgresql-password
|
|
pgpool:
|
|
adminPassword: custom-password-pgpool
|
|
srCheckPassword: custom-password-sr-check
|
|
service:
|
|
ports:
|
|
postgresql: 1234
|
|
persistence:
|
|
size: 1337Mi
|
|
tests:
|
|
- it: "[postgresql-ha] DB settings are applied as expected"
|
|
template: charts/postgresql-ha/templates/postgresql/statefulset.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: POSTGRES_DB
|
|
value: "gitea-database"
|
|
- documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: POSTGRES_USER
|
|
value: "gitea-username"
|
|
- it: "[postgresql-ha] DB passwords are applied as expected"
|
|
template: charts/postgresql-ha/templates/postgresql/secrets.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["repmgr-password"]
|
|
value: "Y3VzdG9tLXBhc3N3b3JkLXJlcG1ncg=="
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["postgres-password"]
|
|
value: "Y3VzdG9tLXBhc3N3b3JkLXBvc3RncmVz"
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["password"]
|
|
value: "Z2l0ZWEtcGFzc3dvcmQ=" # postgresql-ha.postgresql.password is overwritten by postgresql-ha.global.postgresql.password and should not be referenced here
|
|
- it: "[postgresql-ha] pgpool.adminPassword is applied as expected"
|
|
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["admin-password"]
|
|
value: "Y3VzdG9tLXBhc3N3b3JkLXBncG9vbA=="
|
|
- it: "[postgresql-ha] pgpool.adminPassword is applied as expected"
|
|
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["admin-password"]
|
|
value: "Y3VzdG9tLXBhc3N3b3JkLXBncG9vbA=="
|
|
- it: "[postgresql-ha] pgpool.adminPassword is applied as expected"
|
|
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["admin-password"]
|
|
value: "Y3VzdG9tLXBhc3N3b3JkLXBncG9vbA=="
|
|
- it: "[postgresql-ha] pgpool.srCheckPassword is applied as expected"
|
|
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["sr-check-password"]
|
|
value: "Y3VzdG9tLXBhc3N3b3JkLXNyLWNoZWNr"
|
|
- it: "[postgresql-ha] persistence.size is applied as expected"
|
|
template: charts/postgresql-ha/templates/postgresql/statefulset.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
|
|
value: "1337Mi"
|
|
- it: "[postgresql-ha] service.ports.postgresql is applied as expected"
|
|
template: charts/postgresql-ha/templates/pgpool/service.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: spec.ports[0].port
|
|
value: 1234
|
|
- it: "[postgresql-ha] renders the referenced service"
|
|
template: charts/postgresql-ha/templates/pgpool/service.yaml
|
|
asserts:
|
|
- containsDocument:
|
|
kind: Service
|
|
apiVersion: v1
|
|
name: gitea-unittests-postgresql-ha-pgpool
|
|
namespace: testing
|
|
- it: "[gitea] connects to pgpool service"
|
|
template: templates/secret_inlineConfig.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.database
|
|
pattern: HOST=gitea-unittests-postgresql-ha-pgpool.testing.svc.cluster.local:1234
|
|
- it: "[gitea] connects to pgpool service with custom cluster domain"
|
|
set:
|
|
clusterDomain: my-special-cluster.local
|
|
template: templates/secret_inlineConfig.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.database
|
|
pattern: HOST=gitea-unittests-postgresql-ha-pgpool.testing.svc.my-special-cluster.local:1234
|
|
- it: "[gitea] connects to configured database"
|
|
template: templates/secret_inlineConfig.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.database
|
|
pattern: NAME=gitea-database
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.database
|
|
pattern: USER=gitea-username
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.database
|
|
pattern: PASSWD=gitea-password
|