From 438c0af8bef745e0209d8867b78e80ce13a4ceb5 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 16 Jul 2024 16:36:31 -0400 Subject: [PATCH] resolve issues && add test unit --- charts/cryostat/tests/deployment_test.yaml | 2 +- charts/cryostat/tests/pvc_test.yaml | 2 +- charts/cryostat/tests/role_test.yaml | 4 +- charts/cryostat/tests/route_test.yaml | 2 +- charts/cryostat/tests/service_test.yaml | 58 ++++++++++++++++++++++ 5 files changed, 63 insertions(+), 5 deletions(-) diff --git a/charts/cryostat/tests/deployment_test.yaml b/charts/cryostat/tests/deployment_test.yaml index e5b32105..67971fe1 100644 --- a/charts/cryostat/tests/deployment_test.yaml +++ b/charts/cryostat/tests/deployment_test.yaml @@ -39,7 +39,7 @@ tests: - equal: path: metadata.labels value: - helm.sh/chart: cryostat-0.5.0-dev + helm.sh/chart: cryostat-2.0.0-dev app.kubernetes.io/name: cryostat app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/version: "4.0.0-dev" diff --git a/charts/cryostat/tests/pvc_test.yaml b/charts/cryostat/tests/pvc_test.yaml index 44e19cf7..6484d50b 100644 --- a/charts/cryostat/tests/pvc_test.yaml +++ b/charts/cryostat/tests/pvc_test.yaml @@ -32,7 +32,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: cryostat app.kubernetes.io/version: "4.0.0-dev" - helm.sh/chart: cryostat-0.5.0-dev + helm.sh/chart: cryostat-2.0.0-dev - equal: path: spec.accessModes value: diff --git a/charts/cryostat/tests/role_test.yaml b/charts/cryostat/tests/role_test.yaml index b8db0feb..75723b13 100644 --- a/charts/cryostat/tests/role_test.yaml +++ b/charts/cryostat/tests/role_test.yaml @@ -39,7 +39,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: cryostat app.kubernetes.io/version: "4.0.0-dev" - helm.sh/chart: cryostat-0.5.0-dev + helm.sh/chart: cryostat-2.0.0-dev documentIndex: 0 - equal: path: metadata.labels @@ -48,7 +48,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: cryostat app.kubernetes.io/version: "4.0.0-dev" - helm.sh/chart: cryostat-0.5.0-dev + helm.sh/chart: cryostat-2.0.0-dev documentIndex: 1 - it: should have correct permissions for endpoints, pods, and other resources diff --git a/charts/cryostat/tests/route_test.yaml b/charts/cryostat/tests/route_test.yaml index 3c020281..b29cabb7 100644 --- a/charts/cryostat/tests/route_test.yaml +++ b/charts/cryostat/tests/route_test.yaml @@ -34,7 +34,7 @@ tests: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: cryostat app.kubernetes.io/version: "4.0.0-dev" - helm.sh/chart: cryostat-0.5.0-dev + helm.sh/chart: cryostat-2.0.0-dev - equal: path: metadata.annotations.hello value: "world" diff --git a/charts/cryostat/tests/service_test.yaml b/charts/cryostat/tests/service_test.yaml index 55154c7a..5fa3dd0e 100644 --- a/charts/cryostat/tests/service_test.yaml +++ b/charts/cryostat/tests/service_test.yaml @@ -41,6 +41,64 @@ tests: app.kubernetes.io/version: "4.0.0-dev" helm.sh/chart: cryostat-2.0.0-dev + - it: should create a Service with the correct settings when OpenShift authentication is enabled + set: + authentication.openshift.enabled: true + asserts: + - hasDocuments: + count: 1 + - equal: + path: kind + value: Service + - equal: + path: metadata.name + value: RELEASE-NAME-cryostat + - equal: + path: spec.type + value: ClusterIP + - equal: + path: spec.ports[0].port + value: 8181 + - equal: + path: spec.ports[0].targetPort + value: 4180 + - equal: + path: spec.ports[0].protocol + value: TCP + - equal: + path: spec.ports[0].name + value: cryostat-http + - equal: + path: spec.ports[1].port + value: 443 + - equal: + path: spec.ports[1].targetPort + value: 8443 + - equal: + path: spec.ports[1].protocol + value: TCP + - equal: + path: spec.ports[1].name + value: cryostat-https + - equal: + path: spec.selector + value: + app.kubernetes.io/name: cryostat + app.kubernetes.io/instance: RELEASE-NAME + - equal: + path: metadata.labels + value: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: cryostat + app.kubernetes.io/version: "4.0.0-dev" + helm.sh/chart: cryostat-2.0.0-dev + - equal: + path: metadata.annotations + value: + service.alpha.openshift.io/serving-cert-secret-name: RELEASE-NAME-proxy-tls + + - it: should include OpenShift specific annotations when OpenShift auth is enabled set: authentication.openshift.enabled: true