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>
42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
suite: GPG secret template (signing enabled)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/secret_gpg.yaml
|
|
tests:
|
|
- it: fails rendering when nothing is configured
|
|
set:
|
|
secrets.gpg.enabled: true
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Either specify `secrets.gpg.new.privateKey` or reference an existing Secret via `secrets.gpg.existingSecret`
|
|
- it: skips rendering using external secret reference
|
|
set:
|
|
secrets.gpg.enabled: true
|
|
secrets.gpg.existingSecret.enabled: true
|
|
secrets.gpg.existingSecret.secretName: "external-secret-reference"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
- it: renders secret specification using inline gpg key
|
|
set:
|
|
secrets.gpg.enabled: true
|
|
secrets.gpg.new.privateKey: "gpg-key-placeholder"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- documentIndex: 0
|
|
containsDocument:
|
|
kind: Secret
|
|
apiVersion: v1
|
|
name: gitea-unittests-gpg-key
|
|
- isNotNullOrEmpty:
|
|
path: metadata.labels
|
|
- equal:
|
|
path: data.gpgHome
|
|
value: "L2RhdGEvZ2l0Ly5nbnVwZw=="
|
|
- equal:
|
|
path: data.privateKey
|
|
value: "Z3BnLWtleS1wbGFjZWhvbGRlcg=="
|