helm-charts/charts/library/common-test/tests/service/ports_test.yaml
2024-03-08 08:51:40 +01:00

71 lines
1.7 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service ports
templates:
- common.yaml
tests:
- it: default should pass
values:
- ../_values/service_main_default.yaml
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0]
value:
name: http
port: 8081
protocol: TCP
targetPort: 8081
- it: custom name should pass
values:
- ../_values/service_main_default.yaml
set:
service:
main:
ports:
http:
enabled: false
server:
enabled: true
port: 8080
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0]
value:
name: server
port: 8080
protocol: TCP
targetPort: 8080
- it: custom target port should pass
values:
- ../_values/service_main_default.yaml
set:
service:
main:
ports:
http:
enabled: true
targetPort: 80
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0]
value:
name: http
port: 8081
protocol: TCP
targetPort: 80