feat(common): Release common library 3.7.1 (#383)

Co-authored-by: Aisling McGinn <me@aisling.dev>
This commit is contained in:
Bernd Schorgers 2025-02-11 13:23:27 +01:00 committed by GitHub
parent c94a28baa3
commit 433f6d132b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
146 changed files with 232 additions and 222 deletions

View file

@ -0,0 +1,94 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route metadata
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
set:
route.main:
parentRefs:
- name: test
namespace: test
asserts:
- documentIndex: &routeDocument 1
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
notExists:
path: metadata.annotations
- documentIndex: *routeDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
route.main:
annotations:
test_annotation: test
labels:
test_label: test
parentRefs:
- name: test
namespace: test
asserts:
- documentIndex: &routeDocument 1
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *routeDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
route.main:
annotations:
test_annotation: test
labels:
test_label: test
parentRefs:
- name: test
namespace: test
asserts:
- documentIndex: &routeDocument 1
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *routeDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,70 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route presence
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- it: explicitly disabled should pass
set:
route.main.enabled: false
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- it: explicitly enabled should pass
set:
route.main:
enabled: true
parentRefs:
- name: test
namespace: test
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- documentIndex: 1
isKind:
of: HTTPRoute
- it: multiple enabled should pass
set:
route:
main:
parentRefs:
- name: main
namespace: main
test:
parentRefs:
- name: test
namespace: test
asserts:
- hasDocuments:
count: 3
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- documentIndex: 1
isKind:
of: HTTPRoute
- documentIndex: 2
isKind:
of: HTTPRoute

View file

@ -0,0 +1,114 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route service reference
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- group: ""
kind: Service
name: RELEASE-NAME
namespace: NAMESPACE
port: 8080
weight: 1
asserts:
- documentIndex: &HTTPRouteDocument 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].backendRefs[0]
value:
group: ""
kind: Service
name: RELEASE-NAME
namespace: NAMESPACE
port: 8080
weight: 1
- it: custom service reference should pass
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- group: test
name: pathService
port: 1234
namespace: serviceNamespace
weight: 123
asserts:
- documentIndex: &HTTPRouteDocument 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].backendRefs[0]
value:
group: test
kind: Service
name: pathService
namespace: serviceNamespace
port: 1234
weight: 123
- it: custom service reference with filter should fail
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- group: test
name: pathService
port: 1234
namespace: serviceNamespace
weight: 123
filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
asserts:
- failedTemplate:
errorMessage: "backend refs and request redirect filters cannot co-exist."
- it: custom service with filter should pass
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
asserts:
- documentIndex: &HTTPRouteDocument 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].filters[0]
value:
type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
- documentIndex: *HTTPRouteDocument
notExists:
path: spec.rules[0].backendRefs[0]

View file

@ -0,0 +1,348 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: route values
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: setting gateway should pass
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
asserts:
- documentIndex: &HTTPRouteDocument 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.parentRefs[0].name
value: parentName
- documentIndex: *HTTPRouteDocument
equal:
path: spec.parentRefs[0].namespace
value: parentNamespace
- it: custom host and path should pass
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
hostnames:
- chart-test.local
asserts:
- documentIndex: &HTTPRouteDocument 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.hostnames[0]
value: chart-test.local
- it: custom host with template
set:
route.main:
parentRefs:
- name: parentName
namespace: parentNamespace
hostnames:
- "{{ .Release.Name }}.local"
asserts:
- documentIndex: &HTTPRouteDocument 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.hostnames[0]
value: RELEASE-NAME.local
- it: path matches should only be used for HTTPRoutes and GRPCRoutes
set:
route:
main:
kind: HTTPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
kind: Service
weight: 1
matches:
- path:
type: PathPrefix
value: /test
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
timeouts:
backendRequest: 30s
grpc:
kind: GRPCRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
kind: Service
weight: 1
matches:
- path:
type: PathPrefix
value: /test
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
tcp:
kind: TCPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
kind: Service
weight: 1
matches:
- path:
type: PathPrefix
value: /test
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
tls:
kind: TLSRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
kind: Service
weight: 1
matches:
- path:
type: PathPrefix
value: /test
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
udp:
kind: UDPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
kind: Service
weight: 1
matches:
- path:
type: PathPrefix
value: /test
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
asserts:
- documentIndex: &GRPCRouteDocument 1
isKind:
of: GRPCRoute
- documentIndex: *GRPCRouteDocument
equal:
path: spec.rules[0].matches
value:
- path:
type: PathPrefix
value: /test
- documentIndex: *GRPCRouteDocument
equal:
path: spec.rules[0].filters
value:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
- documentIndex: &HTTPRouteDocument 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].matches
value:
- path:
type: PathPrefix
value: /test
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].filters
value:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: ""
- documentIndex: &TCPRouteDocument 3
isKind:
of: TCPRoute
- documentIndex: *TCPRouteDocument
notExists:
path: spec.rules[0].matches
- documentIndex: *TCPRouteDocument
notExists:
path: spec.rules[0].filters
- documentIndex: &TLSRouteDocument 4
isKind:
of: TLSRoute
- documentIndex: *TLSRouteDocument
notExists:
path: spec.rules[0].matches
- documentIndex: *TLSRouteDocument
notExists:
path: spec.rules[0].filters
- documentIndex: &UDPRouteDocument 5
isKind:
of: UDPRoute
- documentIndex: *UDPRouteDocument
notExists:
path: spec.rules[0].matches
- documentIndex: *UDPRouteDocument
notExists:
path: spec.rules[0].filters
- documentIndex: *UDPRouteDocument
notExists:
path: spec.rules[0].timeouts
- it: hostnames shouldn't be used for TCPRoutes and UDPRoutes
set:
route:
main:
enabled: true
kind: TCPRoute
hostnames:
- chart-test.local
parentRefs:
- name: parentName
namespace: parentNamespace
udp:
enabled: true
kind: UDPRoute
hostnames:
- chart-test.local
parentRefs:
- name: parentName
namespace: parentNamespace
asserts:
- documentIndex: &TCPRouteDocument 1
isKind:
of: TCPRoute
- documentIndex: *TCPRouteDocument
notExists:
path: spec.hostnames
- documentIndex: &UDPRouteDocument 2
isKind:
of: UDPRoute
- documentIndex: *UDPRouteDocument
notExists:
path: spec.hostnames
- it: sectionName in parentRefs should be optional
set:
route:
main:
enabled: true
parentRefs:
- name: parentName
namespace: parentNamespace
second:
enabled: true
parentRefs:
- name: parentName
namespace: parentNamespace
sectionName: parentSection
asserts:
- documentIndex: &HTTPRouteDocumentFirst 1
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocumentFirst
notExists:
path: spec.parentRefs[0].sectionName
- documentIndex: &HTTPRouteDocumentSecond 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocumentSecond
equal:
path: spec.parentRefs[0].sectionName
value: parentSection
- it: timeouts should only be used for HTTPRoutes
set:
route:
main:
enabled: true
kind: HTTPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
timeouts:
backendRequest: 30s
grpc:
enabled: true
kind: GRPCRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
matches:
- path:
type: PathPrefix
value: /test
timeouts:
backendRequest: 10s
asserts:
- documentIndex: &GRPCRouteDocument 1
isKind:
of: GRPCRoute
- documentIndex: *GRPCRouteDocument
notExists:
path: spec.rules[0].timeouts.backendRequest
- documentIndex: &HTTPRouteDocument 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].timeouts.backendRequest
value: 30s