--- # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json suite: ingress service reference templates: - common.yaml tests: - it: default should pass set: ingress.main.enabled: true 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: 8080 - it: custom service reference should pass set: ingress.main: enabled: true hosts: - host: chart-test.local paths: - path: / service: name: pathService port: 1234 asserts: - documentIndex: &IngressDocument 2 isKind: of: Ingress - documentIndex: *IngressDocument equal: path: spec.rules[0].http.paths[0].backend value: service: name: pathService port: number: 1234 - it: multiple hosts with port name references should pass set: service: main: ports: http: port: &httpPort 8081 http2: enabled: true port: &http2Port 1880 ingress: main: enabled: true className: "nginx" hosts: - host: http.chart-test.local paths: - path: / pathType: Prefix service: name: main port: http - host: http2.chart-test.local paths: - path: / pathType: Prefix service: name: 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