helm-charts/charts/library/common/test-chart/unittests/route/field_parentRefs_test.yaml
Bernd Schorgers a01a89cb13
feat(common): Release common 4.0.0 (#398)
Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
2025-05-16 08:55:14 +02:00

67 lines
1.9 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route - fields - parentRefs
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: setting gateway should pass
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
documentSelector:
path: $[?(@.kind == "HTTPRoute")].metadata.name
value: release-name
asserts:
- equal:
path: spec.parentRefs[0].name
value: parentName
- equal:
path: spec.parentRefs[0].namespace
value: parentNamespace
- it: sectionName should be optional
set:
route:
main:
parentRefs:
- name: parentName
namespace: parentNamespace
second:
parentRefs:
- name: parentName
namespace: parentNamespace
sectionName: parentSection
asserts:
- documentSelector:
path: $[?(@.kind == "HTTPRoute")].metadata.name
value: release-name-main
notExists:
path: spec.parentRefs[0].sectionName
- documentSelector:
path: $[?(@.kind == "HTTPRoute")].metadata.name
value: release-name-second
equal:
path: spec.parentRefs[0].sectionName
value: parentSection
- it: should be possible to configure port on the parentRefs
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
port: 443
documentSelector:
path: $[?(@.kind == "HTTPRoute")].metadata.name
value: release-name
asserts:
- equal:
path: spec.parentRefs[0].name
value: parentName
- equal:
path: spec.parentRefs[0].port
value: 443