Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 14, 2024
1 parent adf96f2 commit ec5c114
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
19 changes: 19 additions & 0 deletions charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
65 changes: 64 additions & 1 deletion charts/cryostat/tests/cryostat_service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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

0 comments on commit ec5c114

Please sign in to comment.