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

144 lines
3.6 KiB
YAML

chart:
appVersion: 1.27.3
release:
name: gitea-unittests
namespace: testing
suite: Test ingress.yaml
templates:
- templates/ingress.yaml
tests:
- it: Skip ingress if ingress is disabled
set:
ingress.enabled: false
service.http.enabled: true
asserts:
- hasDocuments:
count: 0
- it: Skip ingress if HTTP Service is disabled
set:
ingress.enabled: true
service.http.enabled: false
asserts:
- hasDocuments:
count: 0
- it: Skip ingress if both ingress and HTTP Service are disabled
set:
ingress.enabled: false
service.http.enabled: false
asserts:
- hasDocuments:
count: 0
- it: Render ingress with default values
set:
ingress.enabled: true
service.http.enabled: true
asserts:
- hasDocuments:
count: 1
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: gitea-unittests
namespace: testing
- notExists:
path: metadata.annotations
- isSubset:
path: metadata.labels
content:
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
helm.sh/chart: gitea-0.0.0
version: 1.27.3
- equal:
path: spec.ingressClassName
value: nginx
- contains:
path: spec.rules
content:
host: git.example.com
http:
paths:
- backend:
service:
name: gitea-unittests-http
port:
number: 3000
path: /
pathType: Prefix
- it: Render ingress with TLS
set:
ingress.enabled: true
ingress.tls:
- hosts:
- git.example.com
secretName: tls-secret
service.http.enabled: true
asserts:
- hasDocuments:
count: 1
- contains:
path: spec.tls
content:
hosts:
- git.example.com
secretName: tls-secret
- it: Render ingress with custom HTTP service spec
set:
ingress.enabled: true
service.http.enabled: true
service.http.port: 32000
asserts:
- hasDocuments:
count: 1
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: gitea-unittests
namespace: testing
- contains:
path: spec.rules
content:
host: git.example.com
http:
paths:
- backend:
service:
name: gitea-unittests-http
port:
number: 32000
path: /
pathType: Prefix
- it: Render ingress with custom annotations and labels
set:
ingress.enabled: true
ingress.annotations:
custom-annotation: custom-value
ingress.labels:
custom-label: custom-value
service.http.enabled: true
asserts:
- hasDocuments:
count: 1
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: gitea-unittests
namespace: testing
- isSubset:
path: metadata.annotations
content:
custom-annotation: custom-value
- isSubset:
path: metadata.labels
content:
custom-label: custom-value