Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for PR 450 #611

Merged
merged 7 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading