helm-charts/charts/library/common-test/tests/service/port_protocols_test.yaml
2024-03-15 08:33:07 +00:00

94 lines
2.4 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service protocols
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.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].protocol
value: TCP
- it: explicit TCP should pass
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: TCP
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0].protocol
value: TCP
- it: explicit UDP should pass
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: UDP
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0].protocol
value: UDP
- it: explicit HTTP should pass
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: HTTP
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0].protocol
value: TCP
- documentIndex: *ServiceDocument
notExists:
path: metadata.annotations
- it: explicit HTTPS should pass
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: HTTPS
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0].protocol
value: TCP
- it: explicit appProtocol should pass
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.appProtocol: kubernetes.io/h2c
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.ports[0].appProtocol
value: kubernetes.io/h2c