helm-charts/charts/library/common-test/tests/ingress/values_test.yaml
2024-03-11 10:28:52 +01:00

99 lines
2.5 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress values
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/service_main_default.yaml
tests:
- it: default should pass
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].host
value: chart-example.local
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].http.paths[0].path
value: "/"
- it: custom host and path should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: /test
service:
identifier: main
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].host
value: chart-test.local
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].http.paths[0].path
value: "/test"
- it: host with template should pass
set:
ingress.main:
hosts:
- host: "{{ .Release.Name }}.hostname"
paths:
- path: /
service:
identifier: main
port: http
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].host
value: RELEASE-NAME.hostname
- it: path with template should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: "/{{ .Release.Name }}.path"
service:
identifier: main
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].http.paths[0].path
value: "/RELEASE-NAME.path"
- it: with defaultBackend should pass
set:
ingress.main:
defaultBackend: test
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.defaultBackend
value: test
- documentIndex: *IngressDocument
notExists:
path: spec.rules