Skip to content
Snippets Groups Projects
Commit 5edc729d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-3328 helm unittest cleanup and add tests to cover fully cover helm charts

parent 680c26f7
No related branches found
No related tags found
No related merge requests found
Showing
with 61 additions and 92 deletions
......@@ -32,6 +32,8 @@ tests:
asserts:
- isKind:
of: ConfigMap
- isAPIVersion:
of: v1
- equal:
path: metadata.name
value: bindings-type
......
......@@ -28,13 +28,13 @@ release:
namespace: sh-helm-test
templates:
- deployment.yaml
tests:
- it: validate image type and container image
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: validate image type and container image
asserts:
- equal:
path: spec.template.spec.containers[0].name
......@@ -47,11 +47,6 @@ tests:
value: Always
- it: validate health checks
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
......@@ -78,11 +73,6 @@ tests:
timeoutSeconds: 5
- it: validate security context
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext
......
......@@ -28,42 +28,30 @@ release:
namespace: sh-helm-test
templates:
- templates/deployment.yaml
tests:
- it: check metadata labels
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: check metadata labels
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/instance"]
value: ozgcloud-elasticsearch-operator
- equal:
path: metadata.labels["app.kubernetes.io/name"]
value: ozgcloud-elasticsearch-operator
- equal:
path: metadata.labels["app.kubernetes.io/part-of"]
value: ozg
- equal:
path: metadata.labels["app.kubernetes.io/namespace"]
value: sh-helm-test
path: metadata.labels
value:
app.kubernetes.io/instance: ozgcloud-elasticsearch-operator
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: ozgcloud-elasticsearch-operator
app.kubernetes.io/namespace: sh-helm-test
app.kubernetes.io/part-of: ozg
app.kubernetes.io/version: 0.0.0-MANAGED-BY-JENKINS
helm.sh/chart: ozgcloud-elasticsearch-operator-0.0.0-MANAGED-BY-JENKINS
- it: check metadata name
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: metadata.name
value: ozgcloud-elasticsearch-operator
- it: check metadata namespace
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: metadata.namespace
......
......@@ -27,6 +27,11 @@ release:
name: afm-adapter
templates:
- templates/deployment.yaml
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: test resources
set:
......@@ -37,10 +42,6 @@ tests:
requests:
cpu: "33m"
memory: "44Mi"
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: spec.template.spec.containers[0].resources.limits.cpu
......@@ -56,11 +57,6 @@ tests:
value: 44Mi
- it: test empty resources
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- isEmpty:
path: spec.template.spec.containers[0].resources
......
......@@ -28,35 +28,25 @@ release:
namespace: sh-helm-test
templates:
- deployment.yaml
tests:
- it: validate serviceaccount name
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: validate serviceaccount name
asserts:
- equal:
path: spec.template.spec.serviceAccountName
value: ozgcloud-elasticsearch-operator-serviceaccount
- it: validate restartPolicy
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: spec.template.spec.restartPolicy
value: Always
- it: validate dns config
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- equal:
path: spec.template.spec.dnsConfig
......@@ -64,3 +54,17 @@ tests:
- equal:
path: spec.template.spec.dnsPolicy
value: ClusterFirst
- it: should have correct values for container terminationMessagePolicy, terminationMessagePath, stdin, tty
asserts:
- equal:
path: spec.template.spec.containers[0].terminationMessagePolicy
value: File
- equal:
path: spec.template.spec.containers[0].terminationMessagePath
value: /dev/termination-log
- equal:
path: spec.template.spec.containers[0].stdin
value: true
- equal:
path: spec.template.spec.containers[0].tty
value: true
\ No newline at end of file
......@@ -28,13 +28,13 @@ release:
namespace: sh-helm-test
templates:
- deployment.yaml
tests:
- it: validate template type and api Version
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: validate template type and api Version
asserts:
- isKind:
of: Deployment
......
......@@ -22,19 +22,20 @@
# unter der Lizenz sind dem Lizenztext zu entnehmen.
#
suite: deployment type test
suite: deployment volumes test
release:
name: elastic-test-operator
namespace: sh-helm-test
templates:
- deployment.yaml
tests:
- it: should create SERVICE_BINDING_ROOT
- templates/deployment.yaml
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: should create SERVICE_BINDING_ROOT
asserts:
- contains:
path: spec.template.spec.containers[0].env
......@@ -43,11 +44,6 @@ tests:
value: "/bindings"
- it: should create volumes
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- contains:
path: spec.template.spec.volumes
......@@ -64,11 +60,6 @@ tests:
optional: false
- it: should create volumeMounts
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
......
......@@ -5,7 +5,3 @@ image:
imagePullSecret: "docker-secret"
env:
customList:
- name: my_test_environment_name
value: "A test value"
\ No newline at end of file
......@@ -33,6 +33,8 @@ tests:
asserts:
- isKind:
of: ServiceAccount
- isAPIVersion:
of: v1
- equal:
path: metadata.name
value: ozgcloud-elasticsearch-operator-serviceaccount
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment