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>
98 lines
3.1 KiB
YAML
98 lines
3.1 KiB
YAML
suite: Dependency checks | Customization integrity | postgresql
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
set:
|
|
postgresql-ha:
|
|
enabled: false
|
|
postgresql:
|
|
enabled: true
|
|
global:
|
|
postgresql:
|
|
auth:
|
|
password: gitea-password
|
|
database: gitea-database
|
|
username: gitea-username
|
|
service:
|
|
ports:
|
|
postgresql: 1234
|
|
primary:
|
|
persistence:
|
|
size: 1337Mi
|
|
tests:
|
|
- it: "[postgresql] DB settings are applied as expected"
|
|
template: charts/postgresql/templates/primary/statefulset.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: POSTGRES_DATABASE
|
|
value: "gitea-database"
|
|
- documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: POSTGRES_USER
|
|
value: "gitea-username"
|
|
- it: "[postgresql] DB password is applied as expected"
|
|
template: charts/postgresql/templates/secrets.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: data["password"]
|
|
value: "Z2l0ZWEtcGFzc3dvcmQ="
|
|
- it: "[postgresql] primary.persistence.size is applied as expected"
|
|
template: charts/postgresql/templates/primary/statefulset.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
|
|
value: "1337Mi"
|
|
- it: "[postgresql] global.postgresql.service.ports.postgresql is applied as expected"
|
|
template: charts/postgresql/templates/primary/svc.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: spec.ports[0].port
|
|
value: 1234
|
|
- it: "[postgresql] renders the referenced service"
|
|
template: charts/postgresql/templates/primary/svc.yaml
|
|
asserts:
|
|
- containsDocument:
|
|
kind: Service
|
|
apiVersion: v1
|
|
name: gitea-unittests-postgresql
|
|
namespace: testing
|
|
- it: "[gitea] connects to postgresql service"
|
|
template: templates/secret_inlineConfig.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.database
|
|
pattern: HOST=gitea-unittests-postgresql.testing.svc.cluster.local:1234
|
|
- it: "[gitea] connects to postgresql 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.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
|