From ec5c1148ea460b06c2c28025cf5ffbd1a3c4d1e8 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Thu, 14 Nov 2024 16:29:08 -0500 Subject: [PATCH] tests --- .../tests/cryostat_deployment_test.yaml | 19 ++++++ .../cryostat/tests/cryostat_service_test.yaml | 65 ++++++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/charts/cryostat/tests/cryostat_deployment_test.yaml b/charts/cryostat/tests/cryostat_deployment_test.yaml index 64396061..461881b2 100644 --- a/charts/cryostat/tests/cryostat_deployment_test.yaml +++ b/charts/cryostat/tests/cryostat_deployment_test.yaml @@ -401,11 +401,30 @@ tests: - it: should validate volumes and volume mounts asserts: + - lengthEqual: + count: 1 + path: spec.template.spec.volumes - exists: path: spec.template.spec.volumes[?(@.name=='alpha-config')] - exists: path: spec.template.spec.containers[?(@.name=='cryostat-authproxy')].volumeMounts[?(@.mountPath=='/etc/oauth2_proxy/alpha_config')] + - it: should validate volumes and volume mounts with oauth2-proxy self-signed TLS enabled + set: + oauth2Proxy.service.tls.selfSigned.enabled: true + asserts: + - lengthEqual: + count: 2 + path: spec.template.spec.volumes + - exists: + path: spec.template.spec.volumes[?(@.name=='alpha-config')] + - exists: + path: spec.template.spec.containers[?(@.name=='cryostat-authproxy')].volumeMounts[?(@.mountPath=='/etc/oauth2_proxy/alpha_config')] + - exists: + path: spec.template.spec.volumes[?(@.name=='RELEASE-NAME-oauth2proxy-tls')] + - exists: + path: spec.template.spec.containers[?(@.name=='cryostat-authproxy')].volumeMounts[?(@.mountPath=='/etc/tls/private')] + - it: should set image pull secrets if specified set: imagePullSecrets: diff --git a/charts/cryostat/tests/cryostat_service_test.yaml b/charts/cryostat/tests/cryostat_service_test.yaml index 1cc53127..57fd4f09 100644 --- a/charts/cryostat/tests/cryostat_service_test.yaml +++ b/charts/cryostat/tests/cryostat_service_test.yaml @@ -20,6 +20,9 @@ tests: - equal: path: spec.type value: ClusterIP + - lengthEqual: + path: spec.ports + count: 1 - equal: path: spec.ports[0].port value: 8080 @@ -57,6 +60,9 @@ tests: - equal: path: spec.type value: ClusterIP + - lengthEqual: + path: spec.ports + count: 2 - equal: path: spec.ports[0].port value: 8181 @@ -100,7 +106,6 @@ tests: 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: @@ -119,3 +124,61 @@ tests: asserts: - notExists: path: metadata.annotations.`service.alpha.openshift.io/serving-cert-secret-name` + + - it: should create a Service with the correct settings when oauth2-proxy self-signed TLS is enabled + set: + oauth2Proxy.service.tls.selfSigned.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 + - lengthEqual: + path: spec.ports + count: 2 + - 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 + app.kubernetes.io/component: cryostat + - 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 + app.kubernetes.io/component: cryostat