Apply suggestions from code review

Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
This commit is contained in:
Stavros Foteinopoulos 2023-12-13 18:35:27 +02:00 committed by GitHub
parent 31d8e1252d
commit dba21b6c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 27 deletions

View file

@ -11,3 +11,6 @@ tests:
count: 1 count: 1
- isKind: - isKind:
of: DaemonSet of: DaemonSet
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller

View file

@ -9,8 +9,11 @@ tests:
count: 1 count: 1
- isKind: - isKind:
of: Deployment of: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller
- it: should create a Deployment with 3 replicas when `controller.replicaCount` is 3 - it: should create a Deployment with 3 replicas if `controller.replicaCount` is 3
set: set:
controller.replicaCount: 3 controller.replicaCount: 3
asserts: asserts:
@ -18,7 +21,7 @@ tests:
path: spec.replicas path: spec.replicas
value: 3 value: 3
- it: should create a Deployment with resource limits when `controller.resources.limits` is set - it: should create a Deployment with resource limits if `controller.resources.limits` is set
set: set:
controller.resources.limits.cpu: 500m controller.resources.limits.cpu: 500m
controller.resources.limits.memory: 512Mi controller.resources.limits.memory: 512Mi

View file

@ -3,13 +3,15 @@ templates:
- controller-hpa.yaml - controller-hpa.yaml
tests: tests:
- it: should create an hpa when controller kind is Deployment and autoscaling is enabled - it: should create a HPA if `controller.kind` is "Deployment" and `controller.autoscaling.enabled` is true
set: set:
controller.kind: Deployment controller.kind: Deployment
controller.autoscaling.enabled: true controller.autoscaling.enabled: true
controller.keda.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 1 count: 1
- isKind: - isKind:
of: HorizontalPodAutoscaler of: HorizontalPodAutoscaler
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller

View file

@ -1,9 +1,9 @@
suite: test controller keda suite: Controller > KEDA
templates: templates:
- controller-keda.yaml - controller-keda.yaml
tests: tests:
- it: should create a keda scaled object when controller kind is Deployment and keda is enabled - it: should create a ScaledObject if `controller.kind` is "Deployment" and `controller.keda.enabled` is true
set: set:
controller.kind: Deployment controller.kind: Deployment
controller.keda.enabled: true controller.keda.enabled: true
@ -12,3 +12,6 @@ tests:
count: 1 count: 1
- isKind: - isKind:
of: ScaledObject of: ScaledObject
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller

View file

@ -1,16 +1,16 @@
suite: test controller network policy suite: Controller > NetworkPolicy
templates: templates:
- controller-networkpolicy.yaml - controller-networkpolicy.yaml
tests: tests:
- it: should not create a network policy by default - it: should not create a NetworkPolicy if `controller.networkPolicy.enabled` is false
set: set:
controller.networkPolicy.enabled: false controller.networkPolicy.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 count: 0
- it: should create a network policy when enabled - it: should create a NetworkPolicy if `controller.networkPolicy.enabled` is true
set: set:
controller.networkPolicy.enabled: true controller.networkPolicy.enabled: true
asserts: asserts:
@ -18,3 +18,6 @@ tests:
count: 1 count: 1
- isKind: - isKind:
of: NetworkPolicy of: NetworkPolicy
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller

View file

@ -1,19 +1,17 @@
suite: test controller internal service suite: Controller > Service > Internal
templates: templates:
- controller-service-internal.yaml - controller-service-internal.yaml
tests: tests:
- it: should not create an internal service by default - it: should not create an internal Service if `controller.service.internal.enabled` is false
set: set:
controller.service.enabled: true
controller.service.internal.enabled: false controller.service.internal.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 count: 0
- it: should create an internal service when enabled - it: should create an internal Service if `controller.service.internal.enabled` is true and `controller.service.internal.annotations` are set
set: set:
controller.service.enabled: true
controller.service.internal.enabled: true controller.service.internal.enabled: true
controller.service.internal.annotations: controller.service.internal.annotations:
test.annotation: "true" test.annotation: "true"
@ -22,3 +20,6 @@ tests:
count: 1 count: 1
- isKind: - isKind:
of: Service of: Service
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller-internal

View file

@ -1,16 +1,16 @@
suite: test controller metrics service suite: Controller > Service > Metrics
templates: templates:
- controller-service-metrics.yaml - controller-service-metrics.yaml
tests: tests:
- it: should not create a metrics service by default - it: should not create a metrics Service if `controller.metrics.enabled` is false
set: set:
controller.metrics.enabled: false controller.metrics.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 count: 0
- it: should create a metrics service when enabled - it: should create a metrics Service if `controller.metrics.enabled` is true
set: set:
controller.metrics.enabled: true controller.metrics.enabled: true
asserts: asserts:
@ -18,3 +18,6 @@ tests:
count: 1 count: 1
- isKind: - isKind:
of: Service of: Service
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller-metrics

View file

@ -1,18 +1,18 @@
suite: test controller service suite: Controller > Service
templates: templates:
- controller-service.yaml - controller-service.yaml
tests: tests:
- it: should not create any service by default - it: should not create a Service if `controller.service.external.enabled` is false
set: set:
controller.service.enabled: false controller.service.external.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 count: 0
- it: should create a service when enabled - it: should create a Service if `controller.service.external.enabled` is true
set: set:
controller.service.enabled: true controller.service.external.enabled: true
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 1 count: 1
@ -22,7 +22,7 @@ tests:
path: metadata.name path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller value: RELEASE-NAME-ingress-nginx-controller
- it: custom service type - it: should create a Service of type "NodePort" if `controller.service.external.enabled` is true and `controller.service.type` is "NodePort"
set: set:
controller.service.enabled: true controller.service.enabled: true
controller.service.type: NodePort controller.service.type: NodePort

View file

@ -1,16 +1,16 @@
suite: test default backend service suite: Default Backend > Service
templates: templates:
- default-backend-service.yaml - default-backend-service.yaml
tests: tests:
- it: should not create any default backend service by default - it: should not create a Service if `defaultBackend.enabled` is false
set: set:
defaultBackend.enabled: false defaultBackend.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 count: 0
- it: should create a default backend service when enabled - it: should create a Service if `defaultBackend.enabled` is true
set: set:
defaultBackend.enabled: true defaultBackend.enabled: true
asserts: asserts:
@ -22,7 +22,7 @@ tests:
path: metadata.name path: metadata.name
value: RELEASE-NAME-ingress-nginx-defaultbackend value: RELEASE-NAME-ingress-nginx-defaultbackend
- it: verify service port configuration - it: should create a Service with port 80 if `defaultBackend.service.port` is 80
set: set:
defaultBackend.enabled: true defaultBackend.enabled: true
defaultBackend.service.port: 80 defaultBackend.service.port: 80