ingress-nginx-helm/charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml
k8s-infra-cherrypick-robot cbf6d2a7f1
Chart: Deploy PodDisruptionBudget with KEDA. (#11105)
* feat: deploy PDB if Keda is enabled and the minimum amount of replicas is greater than 1

* feat: add the corresponding unit-test to check PDB deployment with Keda

* chore: rename the test of PDB to follow suggested pattern

* chore: update the test-case suite name to the new format

* Update charts/ingress-nginx/templates/controller-poddisruptionbudget.yaml

Co-authored-by: Marco Ebert <marco_ebert@icloud.com>

* Update charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml

Co-authored-by: Marco Ebert <marco_ebert@icloud.com>

---------

Co-authored-by: ramonboorges@gmail.com <ramonboorges@gmail.com>
Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
2024-03-11 15:37:04 -07:00

65 lines
2 KiB
YAML

suite: Controller > PodDisruptionBudget
templates:
- controller-poddisruptionbudget.yaml
tests:
- it: should create a PodDisruptionBudget if `controller.replicaCount` is greater than 1
set:
controller.replicaCount: 2
asserts:
- hasDocuments:
count: 1
- isKind:
of: PodDisruptionBudget
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller
- it: should not create a PodDisruptionBudget if `controller.replicaCount` is less than or equal 1
set:
controller.replicaCount: 1
asserts:
- hasDocuments:
count: 0
- it: should create a PodDisruptionBudget if `controller.autoscaling.enabled` is true and `controller.autoscaling.minReplicas` is greater than 1
set:
controller.autoscaling.enabled: true
controller.autoscaling.minReplicas: 2
asserts:
- hasDocuments:
count: 1
- isKind:
of: PodDisruptionBudget
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller
- it: should not create a PodDisruptionBudget if `controller.autoscaling.enabled` is true and `controller.autoscaling.minReplicas` is less than or equal 1
set:
controller.autoscaling.enabled: true
controller.autoscaling.minReplicas: 1
asserts:
- hasDocuments:
count: 0
- it: should create a PodDisruptionBudget if `controller.keda.enabled` is true and `controller.keda.minReplicas` is greater than 1
set:
controller.keda.enabled: true
controller.keda.minReplicas: 2
asserts:
- hasDocuments:
count: 1
- isKind:
of: PodDisruptionBudget
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller
- it: should not create a PodDisruptionBudget if `controller.keda.enabled` is true and `controller.keda.minReplicas` is less than or equal 1
set:
controller.keda.enabled: true
controller.keda.minReplicas: 1
asserts:
- hasDocuments:
count: 0