Files
helm-gitea/unittests/helm/admin-secret/admin.yaml
T
volker.raschekandCopilot 552fe8c56e
Helm / helm-lint (push) Successful in 9s
changelog / changelog (push) Successful in 29s
Helm / helm-unittest (push) Failing after 21s
Markdown linter / markdown-lint (push) Successful in 17s
Markdown linter / markdown-link-checker (push) Successful in 56s
refactor(templates): move the templates out of the gitea subdirectory
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>
2026-09-14 20:28:17 +02:00

65 lines
1.8 KiB
YAML

suite: Admin secret template
release:
name: gitea-unittests
namespace: testing
templates:
- templates/secret_admin.yaml
tests:
- it: skips rendering when the admin user is disabled
set:
secrets.admin.enabled: false
asserts:
- hasDocuments:
count: 0
- it: skips rendering using an existing secret reference
set:
secrets.admin.enabled: true
secrets.admin.existingSecret.enabled: true
secrets.admin.existingSecret.secretName: "external-secret-reference"
asserts:
- hasDocuments:
count: 0
- it: fails rendering without credentials
set:
secrets.admin.new.password: ""
asserts:
- failedTemplate:
errorMessage: Either specify `secrets.admin.new.username` and `secrets.admin.new.password` or reference an existing Secret via `secrets.admin.existingSecret`
- it: renders the secret specification with the default credentials
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
containsDocument:
kind: Secret
apiVersion: v1
name: gitea-unittests-admin
- isNotNullOrEmpty:
path: metadata.labels
- equal:
path: data.email
value: "Z2l0ZWFAbG9jYWwuZG9tYWlu"
- equal:
path: data.password
value: "cjhzQThDUEhEOSFidDZk"
- equal:
path: data.username
value: "Z2l0ZWFfYWRtaW4="
- it: supports custom annotations and labels
set:
secrets.admin.new.annotations:
custom-annotation: annotation-value
secrets.admin.new.labels:
custom-label: label-value
asserts:
- equal:
path: metadata.annotations["custom-annotation"]
value: annotation-value
- equal:
path: metadata.labels["custom-label"]
value: label-value