From 003a84b7e106012ca1cf83255e858d72d772101c Mon Sep 17 00:00:00 2001 From: smerle33 Date: Tue, 3 Oct 2023 15:09:22 +0200 Subject: [PATCH] add deployement unittest for label and resources --- charts/uplink/templates/deployment.yaml | 4 +++- charts/uplink/tests/defaults_test.yaml | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/charts/uplink/templates/deployment.yaml b/charts/uplink/templates/deployment.yaml index 327a6f6a1..99754f32b 100644 --- a/charts/uplink/templates/deployment.yaml +++ b/charts/uplink/templates/deployment.yaml @@ -64,8 +64,10 @@ spec: httpGet: path: / port: 3030 + {{- with .Values.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/uplink/tests/defaults_test.yaml b/charts/uplink/tests/defaults_test.yaml index 1a7f09d02..822189943 100644 --- a/charts/uplink/tests/defaults_test.yaml +++ b/charts/uplink/tests/defaults_test.yaml @@ -2,6 +2,7 @@ suite: test default behavior of secret.yaml with default values templates: - secret.yaml - pdb.yaml + - deployment.yaml tests: - it: should render with default values without error template: secret.yaml @@ -24,3 +25,24 @@ tests: 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: uplink + - equal: + path: metadata.labels["app.kubernetes.io/managed-by"] + value: Helm + - equal: + path: spec.template.spec.containers[0].name + value: uplink + - equal: + path: spec.template.spec.containers[0].resources.limits.cpu + value: 200m