94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
suite: Test ingress.yaml
|
|
templates:
|
|
- templates/gitea/ingress.yaml
|
|
tests:
|
|
- it: should enable ingress when ingress.enabled is true
|
|
set:
|
|
ingress.enabled: true
|
|
ingress.apiVersion: networking.k8s.io/v1
|
|
ingress.annotations:
|
|
kubernetes.io/ingress.class: nginx
|
|
ingress.className: nginx
|
|
ingress.tls:
|
|
- hosts:
|
|
- example.com
|
|
secretName: tls-secret
|
|
ingress.hosts:
|
|
- host: example.com
|
|
paths: ["/"]
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- isKind:
|
|
of: Ingress
|
|
- equal:
|
|
path: metadata.name
|
|
value: RELEASE-NAME-gitea
|
|
- matchRegex:
|
|
path: apiVersion
|
|
pattern: networking.k8s.io/v1
|
|
- equal:
|
|
path: spec.ingressClassName
|
|
value: nginx
|
|
- equal:
|
|
path: spec.rules[0].host
|
|
value: "example.com"
|
|
- equal:
|
|
path: spec.tls[0].hosts[0]
|
|
value: "example.com"
|
|
- equal:
|
|
path: spec.tls[0].secretName
|
|
value: tls-secret
|
|
- equal:
|
|
path: metadata.annotations["kubernetes.io/ingress.class"]
|
|
value: nginx
|
|
|
|
- it: should not create ingress when ingress.enabled is false
|
|
set:
|
|
ingress.enabled: false
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
|
|
- it: Ingress Class using TPL
|
|
set:
|
|
global.ingress.className: "ingress-class"
|
|
ingress.className: "{{ .Values.global.ingress.className }}"
|
|
ingress.enabled: true
|
|
ingress.hosts[0].host: "some-host"
|
|
ingress.tls:
|
|
- secretName: gitea-tls
|
|
hosts:
|
|
- "some-host"
|
|
asserts:
|
|
- isKind:
|
|
of: Ingress
|
|
- equal:
|
|
path: spec.tls[0].hosts[0]
|
|
value: "some-host"
|
|
- equal:
|
|
path: spec.rules[0].host
|
|
value: "some-host"
|
|
- equal:
|
|
path: spec.ingressClassName
|
|
value: "ingress-class"
|
|
|
|
- it: hostname using TPL
|
|
set:
|
|
global.giteaHostName: "gitea.example.com"
|
|
ingress.enabled: true
|
|
ingress.hosts[0].host: "{{ .Values.global.giteaHostName }}"
|
|
ingress.tls:
|
|
- secretName: gitea-tls
|
|
hosts:
|
|
- "{{ .Values.global.giteaHostName }}"
|
|
asserts:
|
|
- isKind:
|
|
of: Ingress
|
|
- equal:
|
|
path: spec.tls[0].hosts[0]
|
|
value: "gitea.example.com"
|
|
- equal:
|
|
path: spec.rules[0].host
|
|
value: "gitea.example.com"
|