From 17ee81cfc96f1e8b7c69e25c4e5179e22bf4cebc Mon Sep 17 00:00:00 2001 From: Ramon Borges Date: Mon, 11 Mar 2024 19:59:55 +0100 Subject: [PATCH] Update charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml Co-authored-by: Marco Ebert --- .../controller-poddisruptionbudget_test.yaml | 57 ++++++++++++++++--- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml b/charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml index 44df82c47..3055d5351 100644 --- a/charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml +++ b/charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml @@ -3,12 +3,9 @@ templates: - controller-poddisruptionbudget.yaml tests: - - it: should create a PodDisruptionBudget if `controller.kind` is "Deployment" and `controller.keda.enabled` is true + - it: should create a PodDisruptionBudget if `controller.replicaCount` is greater than 1 set: - controller.kind: Deployment - controller.keda.enabled: true - controller.keda.minReplicas: 2 - controller.minAvailable: 1 + controller.replicaCount: 2 asserts: - hasDocuments: count: 1 @@ -17,6 +14,52 @@ tests: - 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: spec.minAvailable - value: 1 + 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