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

114 lines
3.6 KiB
YAML

suite: deployment template
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: Render the deployment (default)
asserts:
- hasDocuments:
count: 1
template: templates/deployment.yaml
- lengthEqual:
path: spec.template.spec.initContainers
count: 3
template: templates/deployment.yaml
- it: Render the deployment (signing)
set:
secrets.gpg.enabled: true
secrets.gpg.existingSecret.enabled: true
secrets.gpg.existingSecret.secretName: "custom-gpg-secret"
asserts:
- hasDocuments:
count: 1
template: templates/deployment.yaml
- lengthEqual:
path: spec.template.spec.initContainers
count: 4
template: templates/deployment.yaml
- it: Render the deployment (extraInitContainers)
set:
deployment.initContainers:
- container:
name: bar
image: docker.io/library/busybox:latest
- link: "initDirectories"
- link: "initAppIni"
- link: "initConfigureGPG"
- link: "initConfigureGitea"
- container:
name: foo
image: docker.io/library/busybox:latest
secrets.gpg.enabled: true
secrets.gpg.existingSecret.enabled: true
secrets.gpg.existingSecret.secretName: "custom-gpg-secret"
asserts:
- hasDocuments:
count: 1
template: templates/deployment.yaml
- lengthEqual:
path: spec.template.spec.initContainers
count: 6
template: templates/deployment.yaml
- equal:
path: spec.template.spec.initContainers[0].name
value: bar
template: templates/deployment.yaml
- equal:
path: spec.template.spec.initContainers[5].name
value: foo
template: templates/deployment.yaml
- it: renders the chart-managed init containers in the configured order
template: templates/deployment.yaml
set:
deployment.initContainers:
- link: "initConfigureGitea"
- link: "initDirectories"
asserts:
- equal:
path: spec.template.spec.initContainers[0].name
value: configure-gitea
- equal:
path: spec.template.spec.initContainers[1].name
value: init-directories
- it: fails when an init container entry sets both container and link
template: templates/deployment.yaml
set:
deployment.initContainers:
- link: "initDirectories"
container:
name: foo
image: docker.io/library/busybox:latest
asserts:
- failedTemplate:
errorMessage: "deployment.initContainers[0]: `container` and `link` are mutually exclusive"
- it: fails when an init container entry sets neither container nor link
template: templates/deployment.yaml
set:
deployment.initContainers:
- name: foo
asserts:
- failedTemplate:
errorMessage: "deployment.initContainers[0]: either `container` or `link` must be set"
- it: fails when an init container links to an unknown configuration
template: templates/deployment.yaml
set:
deployment.initContainers:
- link: "initSomething"
asserts:
- failedTemplate:
errorMessage: "deployment.initContainers[0]: unknown link `initSomething`, expected one of: initAppIni, initConfigureGPG, initConfigureGitea, initDirectories"