helm-charts/charts/library/common-test/tests/ingress/tls_test.yaml
2024-03-07 18:53:41 +00:00

91 lines
2.1 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress tls
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
tests:
- it: default should pass
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
notExists:
path: spec.tls
- it: tls enabled should pass
set:
ingress.main:
tls:
- secretName: test
hosts:
- hostname
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.tls[0]
value:
secretName: test
hosts:
- hostname
- it: tls enabled without secret should pass
set:
ingress.main:
tls:
- hosts:
- hostname
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.tls[0]
value:
hosts:
- hostname
- it: tls enabled with secret template should pass
set:
ingress.main:
tls:
- secretName: "{{ .Release.Name }}-secret"
hosts:
- hostname
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.tls[0]
value:
secretName: RELEASE-NAME-secret
hosts:
- hostname
- it: tls enabled with secret template evaluate empty should pass
set:
ingress.main:
tls:
- secretName: '{{ "" }}'
hosts:
- hostname
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.tls[0]
value:
hosts:
- hostname