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>
119 lines
3.1 KiB
YAML
119 lines
3.1 KiB
YAML
suite: sshService / httpService template (Services configuration)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/service_ssh.yaml
|
|
- templates/service_http.yaml
|
|
tests:
|
|
- it: supports adding custom labels to sshService
|
|
template: templates/service_ssh.yaml
|
|
set:
|
|
service:
|
|
ssh:
|
|
labels:
|
|
gitea/testkey: testvalue
|
|
asserts:
|
|
- equal:
|
|
path: metadata.labels["gitea/testkey"]
|
|
value: "testvalue"
|
|
|
|
- it: keeps existing labels (ssh)
|
|
template: templates/service_ssh.yaml
|
|
set:
|
|
service:
|
|
ssh:
|
|
labels: {}
|
|
asserts:
|
|
- exists:
|
|
path: metadata.labels["app"]
|
|
|
|
- it: supports adding custom labels to httpService
|
|
template: templates/service_http.yaml
|
|
set:
|
|
service:
|
|
http:
|
|
labels:
|
|
gitea/testkey: testvalue
|
|
asserts:
|
|
- equal:
|
|
path: metadata.labels["gitea/testkey"]
|
|
value: "testvalue"
|
|
|
|
- it: keeps existing labels (http)
|
|
template: templates/service_http.yaml
|
|
set:
|
|
service:
|
|
http:
|
|
labels: {}
|
|
asserts:
|
|
- exists:
|
|
path: metadata.labels["app"]
|
|
|
|
- it: render service.ssh.loadBalancerClass if set and type is LoadBalancer
|
|
template: templates/service_ssh.yaml
|
|
set:
|
|
service:
|
|
ssh:
|
|
loadBalancerClass: "example.com/class"
|
|
type: LoadBalancer
|
|
loadBalancerIP: "1.2.3.4"
|
|
loadBalancerSourceRanges:
|
|
- "1.2.3.4/32"
|
|
- "5.6.7.8/32"
|
|
asserts:
|
|
- equal:
|
|
path: spec.loadBalancerClass
|
|
value: "example.com/class"
|
|
- equal:
|
|
path: spec.loadBalancerIP
|
|
value: "1.2.3.4"
|
|
- equal:
|
|
path: spec.loadBalancerSourceRanges
|
|
value: ["1.2.3.4/32", "5.6.7.8/32"]
|
|
|
|
- it: does not render when loadbalancer properties are set but type is not loadBalancerClass
|
|
template: templates/service_http.yaml
|
|
set:
|
|
service:
|
|
http:
|
|
type: ClusterIP
|
|
loadBalancerClass: "example.com/class"
|
|
loadBalancerIP: "1.2.3.4"
|
|
loadBalancerSourceRanges:
|
|
- "1.2.3.4/32"
|
|
- "5.6.7.8/32"
|
|
asserts:
|
|
- notExists:
|
|
path: spec.loadBalancerClass
|
|
- notExists:
|
|
path: spec.loadBalancerIP
|
|
- notExists:
|
|
path: spec.loadBalancerSourceRanges
|
|
|
|
- it: does not render loadBalancerClass by default even when type is LoadBalancer
|
|
template: templates/service_http.yaml
|
|
set:
|
|
service:
|
|
http:
|
|
type: LoadBalancer
|
|
loadBalancerIP: "1.2.3.4"
|
|
asserts:
|
|
- notExists:
|
|
path: spec.loadBalancerClass
|
|
- equal:
|
|
path: spec.loadBalancerIP
|
|
value: "1.2.3.4"
|
|
|
|
- it: both ssh and http services exist
|
|
templates:
|
|
- templates/service_ssh.yaml
|
|
- templates/service_http.yaml
|
|
asserts:
|
|
- matchRegex:
|
|
path: metadata.name
|
|
pattern: "^gitea-unittests-(?:ssh|http)$"
|
|
- matchRegex:
|
|
path: spec.ports[0].name
|
|
pattern: "^(?:ssh|http)$"
|