This commit is contained in:
Laszlo Fogas
2020-10-13 20:19:17 +02:00
parent c6b6171cef
commit b5954f7df6
9 changed files with 149 additions and 0 deletions
+3
View File
@@ -32,6 +32,9 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.command }}
command: ['{{ .Values.shell | default "/bin/sh" }}', {{ .Values.command | quote }}]
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}
@@ -0,0 +1,20 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should set command
set:
command: "while true; date; sleep 2; done"
asserts:
- equal:
path: spec.template.spec.containers[0].command
value: ['/bin/sh', 'while true; date; sleep 2; done']
- it: Should set shell and command
set:
command: "while true; date; sleep 2; done"
shell: "/bin/ash"
asserts:
- equal:
path: spec.template.spec.containers[0].command
value: ['/bin/ash', 'while true; date; sleep 2; done']
@@ -0,0 +1,15 @@
suite: test deployment
templates:
- configmap.yaml
tests:
- it: Should vars in ConfigMap
set:
vars:
var1: value1
var2: value2
asserts:
- equal:
path: data
value:
var1: value1
var2: value2
+22
View File
@@ -0,0 +1,22 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should set image and tag
set:
image.repository: nginx
image.tag: x.y.z
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: nginx:x.y.z
- it: Should set an ImagePullSecret
set:
imagePullSecrets:
- name: regcred
asserts:
- equal:
path: spec.template.spec.imagePullSecrets
value:
- name: regcred
@@ -0,0 +1,33 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
- pvc.yaml
tests:
- it: Should mount volume
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
size: 10Gi
storageClass: default
asserts:
- equal:
path: spec.template.spec.containers[0].volumeMounts
value:
- name: data
mountPath: /var/lib/1clickinfra/data
- it: Should reference volume
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
size: 10Gi
storageClass: default
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: data
persistentVolumeClaim:
claimName: RELEASE-NAME-data
+25
View File
@@ -0,0 +1,25 @@
suite: test deployment
templates:
- ingress.yaml
tests:
- it: Should set Ingress host name
set:
ingress:
host: chart-example.local
asserts:
- equal:
path: spec.tls
value:
- hosts:
- chart-example.local
secretName: tls-RELEASE-NAME
- it: Should set Ingress annotation
set:
ingress:
annotations:
kubernetes.io/ingress.class: nginx
asserts:
- equal:
path: metadata.annotations
value:
kubernetes.io/ingress.class: nginx
+15
View File
@@ -0,0 +1,15 @@
suite: test deployment
templates:
- pvc.yaml
tests:
- it: Should create PVC
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
size: 10Gi
storageClass: default
asserts:
- equal:
path: spec.storageClassName
value: default
+16
View File
@@ -23,3 +23,19 @@ EOF
helm template my-release onechart/onechart -f values.yaml
```
### Running a command in Alpine Linux
```bash
cat << EOF > values.yaml
image:
repository: alpine
tag: 3.12
command: |
echo "hello"
shell: "/bin/ash"
EOF
helm template my-release onechart/onechart -f values.yaml
```