Skip to content

Commit

Permalink
add a unittest for selector and cleanup volumes and resources
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 committed Oct 2, 2023
1 parent 14b7b33 commit b0debe7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
8 changes: 7 additions & 1 deletion charts/javadoc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ spec:
mountPath: /usr/share/nginx/html
- name: config
mountPath: /etc/nginx/conf.d
{{- with .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -67,7 +69,11 @@ spec:
{{- end }}
volumes:
- name: html
{{- if .Values.htmlVolume }}
{{ toYaml .Values.htmlVolume | indent 10 }}
{{- else }}
emptyDir: {}
{{- end }}
- name: config
configMap:
name: javadoc
25 changes: 25 additions & 0 deletions charts/javadoc/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
suite: default tests
templates:
- pdb.yaml
- deployment.yaml
- nginx-configmap.yaml
tests:
- it: should not generate any pdb with default values
template: pdb.yaml
asserts:
- hasDocuments:
count: 0
- it: Should generate a deployment with the default values
template: deployment.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Deployment
- notExists:
path: spec.affinity
- equal:
path: metadata.labels["app.kubernetes.io/name"]
value: javadoc
- equal:
path: metadata.labels["app.kubernetes.io/managed-by"]
value: Helm
- equal:
path: spec.template.spec.volumes[0].name
value: html
- equal:
path: spec.template.spec.volumes[0].emptyDir
value: {}
- notExists:
path: spec.template.spec.containers[0].resources

0 comments on commit b0debe7

Please sign in to comment.