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>
103 lines
2.8 KiB
YAML
103 lines
2.8 KiB
YAML
chart:
|
|
appVersion: 1.27.3 # renovate: datasource=docker registryUrl=https://docker.gitea.com depName=gitea
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
suite: ServiceAccount template
|
|
templates:
|
|
- templates/serviceAccount.yaml
|
|
tests:
|
|
- it: Render the ServiceAccount by default
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: ServiceAccount
|
|
apiVersion: v1
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
- notExists:
|
|
path: metadata.annotations
|
|
- equal:
|
|
path: metadata.labels
|
|
value:
|
|
app: gitea
|
|
app.kubernetes.io/instance: gitea-unittests
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: gitea
|
|
app.kubernetes.io/version: 1.27.3 # renovate: datasource=docker registryUrl=https://docker.gitea.com depName=gitea
|
|
helm.sh/chart: gitea-0.0.0
|
|
version: 1.27.3 # renovate: datasource=docker registryUrl=https://docker.gitea.com depName=gitea
|
|
- equal:
|
|
path: automountServiceAccountToken
|
|
value: false
|
|
- notExists:
|
|
path: imagePullSecrets
|
|
|
|
- it: Skip rendering when serviceAccount.enabled is false
|
|
set:
|
|
serviceAccount:
|
|
enabled: false
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
|
|
- it: Skip rendering when an existing ServiceAccount is used
|
|
set:
|
|
serviceAccount:
|
|
existingServiceAccount:
|
|
enabled: true
|
|
existingServiceAccountName: externally-existing-serviceaccount
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
|
|
- it: Add custom labels when serviceAccount.new.labels is defined
|
|
set:
|
|
serviceAccount:
|
|
new:
|
|
labels:
|
|
custom: label
|
|
asserts:
|
|
- equal:
|
|
path: metadata.labels.custom
|
|
value: label
|
|
|
|
- it: Add custom annotations when serviceAccount.new.annotations is defined
|
|
set:
|
|
serviceAccount:
|
|
new:
|
|
annotations:
|
|
myCustom: annotation
|
|
asserts:
|
|
- equal:
|
|
path: metadata.annotations.myCustom
|
|
value: annotation
|
|
|
|
- it: Mount the token when serviceAccount.new.automountServiceAccountToken is true
|
|
set:
|
|
serviceAccount:
|
|
new:
|
|
automountServiceAccountToken: true
|
|
asserts:
|
|
- equal:
|
|
path: automountServiceAccountToken
|
|
value: true
|
|
|
|
- it: Reference image pull secrets when serviceAccount.new.imagePullSecrets is defined
|
|
set:
|
|
serviceAccount:
|
|
new:
|
|
imagePullSecrets:
|
|
- name: testing-image-pull-secret
|
|
- name: another-pull-secret
|
|
asserts:
|
|
- contains:
|
|
path: imagePullSecrets
|
|
content:
|
|
name: testing-image-pull-secret
|
|
- contains:
|
|
path: imagePullSecrets
|
|
content:
|
|
name: another-pull-secret
|