Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions charts/library/common-test/ci/gateway-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
workload:
main:
enabled: true
podSpec:
containers:
main:
enabled: true
args:
- --port
- "8080"
probes:
liveness:
enabled: true
readiness:
enabled: true
startup:
enabled: true

service:
main:
enabled: true
ports:
main:
enabled: true
port: 8080
protocol: http

gateway:
main:
enabled: true
gatewayClassName: test-gateway-class
listeners:
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Same
kinds:
- group: gateway.networking.k8s.io
kind: HTTPRoute

route:
main:
enabled: true
targetSelector: main
hostnames:
- chart-example.local
rules:
- backendRefs:
- kind: Service
name: main
port: 8080
58 changes: 58 additions & 0 deletions charts/library/common-test/tests/gateway/basic_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
suite: gateway basic test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should create a gateway when enabled
set:
gateway:
main:
enabled: true
gatewayClassName: test-gateway-class
listeners:
- name: http
port: 80
protocol: HTTP
asserts:
- documentIndex: &gatewayDoc 0
isKind:
of: Gateway
- documentIndex: *gatewayDoc
isAPIVersion:
of: gateway.networking.k8s.io/v1
- documentIndex: *gatewayDoc
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *gatewayDoc
equal:
path: spec.gatewayClassName
value: test-gateway-class
- documentIndex: *gatewayDoc
equal:
path: spec.listeners[0].name
value: http
- documentIndex: *gatewayDoc
equal:
path: spec.listeners[0].port
value: 80
- documentIndex: *gatewayDoc
equal:
path: spec.listeners[0].protocol
value: HTTP

- it: should not create a gateway when disabled
set:
gateway:
main:
enabled: false
gatewayClassName: test-gateway-class
listeners:
- name: http
port: 80
protocol: HTTP
asserts:
- hasDocuments:
count: 0
99 changes: 99 additions & 0 deletions charts/library/common-test/tests/gateway/integration_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
suite: gateway and route integration test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should link route to gateway via targetSelector
set:
gateway:
main:
enabled: true
gatewayClassName: test-gateway-class
listeners:
- name: http
port: 80
protocol: HTTP
service:
main:
enabled: true
ports:
main:
enabled: true
port: 8080
route:
main:
enabled: true
targetSelector: main
hostnames:
- chart-example.local
rules:
- backendRefs:
- kind: Service
name: main
port: 8080
asserts:
- documentIndex: &gatewayDoc 0
isKind:
of: Gateway
- documentIndex: *gatewayDoc
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: &routeDoc 2
isKind:
of: HTTPRoute
- documentIndex: *routeDoc
equal:
path: spec.parentRefs[0].kind
value: Gateway
- documentIndex: *routeDoc
equal:
path: spec.parentRefs[0].name
value: test-release-name-common-test
- documentIndex: *routeDoc
equal:
path: spec.parentRefs[0].namespace
value: test-release-namespace

- it: should use manual parentRefs when targetSelector is not set
set:
service:
main:
enabled: true
ports:
main:
enabled: true
port: 8080
route:
main:
enabled: true
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: external-gateway
namespace: external-namespace
hostnames:
- chart-example.local
rules:
- backendRefs:
- kind: Service
name: main
port: 8080
asserts:
- documentIndex: &routeDoc 1
isKind:
of: HTTPRoute
- documentIndex: *routeDoc
equal:
path: spec.parentRefs[0].kind
value: Gateway
- documentIndex: *routeDoc
equal:
path: spec.parentRefs[0].name
value: external-gateway
- documentIndex: *routeDoc
equal:
path: spec.parentRefs[0].namespace
value: external-namespace
2 changes: 1 addition & 1 deletion charts/library/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ sources:
- https://github.com/trueforge-org/truecharts/tree/master/charts/library/common
- https://hub.docker.com/_/
type: library
version: 29.0.2
version: 29.1.0
Loading
Loading