Files
helm-gitea/unittests/helm/deployment/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

104 lines
3.4 KiB
YAML

suite: deployment template (admin user)
release:
name: gitea-unittests
namespace: testing
templates:
- templates/deployment.yaml
- templates/secret_admin.yaml
- templates/secret_config.yaml
- templates/secret_gpg.yaml
- templates/secret_init.yaml
- templates/secret_inlineConfig.yaml
- templates/secret_metrics.yaml
tests:
- it: reads the admin credentials from the generated secret
template: templates/deployment.yaml
asserts:
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_USERNAME
valueFrom:
secretKeyRef:
key: username
name: gitea-unittests-admin
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: gitea-unittests-admin
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_EMAIL
valueFrom:
secretKeyRef:
key: email
name: gitea-unittests-admin
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_PASSWORD_MODE
value: keepUpdated
- it: reads the admin credentials from the configured keys of an existing secret
template: templates/deployment.yaml
set:
secrets.admin.existingSecret.enabled: true
secrets.admin.existingSecret.secretName: custom-admin-secret
secrets.admin.existingSecret.emailKey: custom-email
secrets.admin.existingSecret.passwordKey: custom-password
secrets.admin.existingSecret.usernameKey: custom-username
asserts:
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_USERNAME
valueFrom:
secretKeyRef:
key: custom-username
name: custom-admin-secret
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: custom-password
name: custom-admin-secret
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_EMAIL
valueFrom:
secretKeyRef:
key: custom-email
name: custom-admin-secret
- it: omits the admin environment when the admin user is disabled
template: templates/deployment.yaml
set:
secrets.admin.enabled: false
asserts:
- notContains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_USERNAME
any: true
- notContains:
path: spec.template.spec.initContainers[2].env
content:
name: GITEA_ADMIN_PASSWORD_MODE
any: true
- it: fails on an unsupported password mode
template: templates/deployment.yaml
set:
secrets.admin.passwordMode: unsupported
asserts:
- failedTemplate:
errorMessage: "`secrets.admin.passwordMode` must be set to one of 'keepUpdated', 'initialOnlyNoReset', or 'initialOnlyRequireReset'. Received: 'unsupported'"