mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 16:37:04 +02:00
143 lines
3.9 KiB
YAML
143 lines
3.9 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
|
suite: ingress service reference
|
|
templates:
|
|
- common.yaml
|
|
values:
|
|
- ../_values/ingress_main_default_hosts.yaml
|
|
- ../_values/controllers_main_default_container.yaml
|
|
tests:
|
|
- it: default should pass
|
|
set:
|
|
service:
|
|
main:
|
|
controller: main
|
|
ports:
|
|
http:
|
|
port: &httpPort 8081
|
|
asserts:
|
|
- documentIndex: &IngressDocument 2
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].http.paths[0].backend
|
|
value:
|
|
service:
|
|
name: RELEASE-NAME
|
|
port:
|
|
number: *httpPort
|
|
|
|
- it: custom service reference should pass
|
|
set:
|
|
ingress.main:
|
|
hosts:
|
|
- host: chart-test.local
|
|
paths:
|
|
- path: /
|
|
service:
|
|
name: pathService
|
|
port: 1234
|
|
asserts:
|
|
- documentIndex: &IngressDocument 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].http.paths[0].backend
|
|
value:
|
|
service:
|
|
name: pathService
|
|
port:
|
|
number: 1234
|
|
|
|
- it: custom service reference with template should pass
|
|
set:
|
|
ingress.main:
|
|
hosts:
|
|
- host: chart-test.local
|
|
paths:
|
|
- path: /
|
|
service:
|
|
name: "{{ .Release.Name }}"
|
|
port: 1234
|
|
asserts:
|
|
- documentIndex: &IngressDocument 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].http.paths[0].backend
|
|
value:
|
|
service:
|
|
name: RELEASE-NAME
|
|
port:
|
|
number: 1234
|
|
|
|
- it: multiple hosts with port name references should pass
|
|
set:
|
|
service:
|
|
main:
|
|
controller: main
|
|
ports:
|
|
http:
|
|
port: &httpPort 8081
|
|
http2:
|
|
enabled: true
|
|
port: &http2Port 1880
|
|
ingress:
|
|
main:
|
|
className: "nginx"
|
|
hosts:
|
|
- host: http.chart-test.local
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
service:
|
|
identifier: main
|
|
port: http
|
|
- host: http2.chart-test.local
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
service:
|
|
identifier: main
|
|
port: http2
|
|
asserts:
|
|
- documentIndex: &IngressDocument 2
|
|
isKind:
|
|
of: Ingress
|
|
# First Ingress host
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].host
|
|
value: http.chart-test.local
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].http.paths[0].path
|
|
value: "/"
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].http.paths[0].backend.service.name
|
|
value: "RELEASE-NAME"
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[0].http.paths[0].backend.service.port.number
|
|
value: *httpPort
|
|
# Second Ingress host
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[1].host
|
|
value: http2.chart-test.local
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[1].http.paths[0].path
|
|
value: "/"
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[1].http.paths[0].backend.service.name
|
|
value: "RELEASE-NAME"
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: spec.rules[1].http.paths[0].backend.service.port.number
|
|
value: *http2Port
|