Skip to content

Commit

Permalink
Unit tests for PR 450 (#611)
Browse files Browse the repository at this point in the history
* Add unit tests for #450.
  • Loading branch information
robholland authored Dec 10, 2024
1 parent 56ce221 commit 51cb16c
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/temporal/templates/admintools-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
{{ include "temporal.serviceAccount" $ }}
{{- if $.Values.admintools.additionalInitContainers }}
initContainers:
{{- toYaml $.Values.admintools.additionalInitContainers | nindent 8}}
{{- toYaml $.Values.admintools.additionalInitContainers | nindent 8 }}
{{- end }}
containers:
- name: admin-tools
Expand Down
21 changes: 10 additions & 11 deletions charts/temporal/templates/server-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ spec:
{{ include "temporal.serviceAccount" $ }}
restartPolicy: OnFailure
initContainers:
{{- if $.Values.admintools.additionalInitContainers }}
{{- toYaml $.Values.admintools.additionalInitContainers | nindent 8 }}
{{- end }}
{{- if $.Values.cassandra.enabled }}
- name: check-cassandra-service
image: busybox
Expand Down Expand Up @@ -56,7 +59,7 @@ spec:
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
{{- with $.Values.server.additionalVolumeMounts }}
{{- with $.Values.admintools.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand All @@ -83,7 +86,7 @@ spec:
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
{{- with $.Values.server.additionalVolumeMounts }}
{{- with $.Values.admintools.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -118,7 +121,7 @@ spec:
{{- end }}
env:
{{- include "temporal.admintools-env" (list $ $store) | nindent 12 }}
{{- with $.Values.server.additionalVolumeMounts }}
{{- with $.Values.admintools.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand All @@ -143,7 +146,7 @@ spec:
env:
- name: TEMPORAL_ADDRESS
value: "{{ include "temporal.fullname" $ }}-frontend.{{ $.Release.Namespace }}.svc:{{ $.Values.server.frontend.service.port }}"
{{- with $.Values.server.additionalVolumeMounts }}
{{- with $.Values.admintools.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -178,19 +181,15 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.server.nodeSelector }}
{{- with $.Values.admintools.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.server.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.server.tolerations }}
{{- with $.Values.admintools.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.server.additionalVolumes }}
{{- with $.Values.admintools.additionalVolumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
31 changes: 31 additions & 0 deletions charts/temporal/tests/admintools_deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
suite: test admintools deployment
templates:
- admintools-deployment.yaml
tests:
- it: includes additional init containers
set:
admintools:
additionalInitContainers:
- name: my-init-container
asserts:
- equal:
path: spec.template.spec.initContainers[0].name
value: my-init-container
- it: includes additional volumes
set:
admintools:
additionalVolumes:
- name: my-volume
asserts:
- equal:
path: spec.template.spec.volumes[0].name
value: my-volume
- it: includes additional volume mounts
set:
admintools:
additionalVolumeMounts:
- name: my-volume
asserts:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0].name
value: my-volume
14 changes: 14 additions & 0 deletions charts/temporal/tests/server_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ tests:
- equal:
path: spec.template.spec.containers[0].resources.requests.cpu
value: 200m
- it: includes additional init containers
template: templates/server-deployment.yaml
documentSelector:
path: .kind
value: Deployment
matchMany: true
set:
server:
additionalInitContainers:
- name: my-init-container
asserts:
- equal:
path: spec.template.spec.initContainers[0].name
value: my-init-container
31 changes: 31 additions & 0 deletions charts/temporal/tests/server_job_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
suite: test server job
templates:
- server-job.yaml
tests:
- it: includes additional init containers
set:
admintools:
additionalInitContainers:
- name: my-init-container
asserts:
- equal:
path: spec.template.spec.initContainers[0].name
value: my-init-container
- it: includes additional volumes
set:
admintools:
additionalVolumes:
- name: my-volume
asserts:
- equal:
path: spec.template.spec.volumes[0].name
value: my-volume
- it: includes additional volume mounts
set:
admintools:
additionalVolumeMounts:
- name: my-volume
asserts:
- equal:
path: spec.template.spec.initContainers[*].volumeMounts[0].name
value: my-volume

0 comments on commit 51cb16c

Please sign in to comment.