From 6ea7d984ab4b66f5b7d896fb0846429737dde38e Mon Sep 17 00:00:00 2001 From: Maksym Bruner Date: Tue, 12 Dec 2023 14:06:14 +0800 Subject: [PATCH] chore(caraml): add tests for turing --- charts/caraml-authz/templates/_helpers.tpl | 2 -- charts/mlp/templates/_helpers.tpl | 2 -- .../turing/tests/turing_deployment_test.yaml | 26 ++++++++++++++++++- charts/xp-management/templates/_helpers.tpl | 4 +-- charts/xp-treatment/templates/_helpers.tpl | 2 -- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/charts/caraml-authz/templates/_helpers.tpl b/charts/caraml-authz/templates/_helpers.tpl index 4579aa27..82255b3a 100644 --- a/charts/caraml-authz/templates/_helpers.tpl +++ b/charts/caraml-authz/templates/_helpers.tpl @@ -51,9 +51,7 @@ Common labels {{- define "caraml-authz.labels" -}} app.kubernetes.io/name: {{ template "caraml-authz.name" . }} helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote}} -{{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ template "caraml-authz.version" . }} -{{- end }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/part-of: caraml diff --git a/charts/mlp/templates/_helpers.tpl b/charts/mlp/templates/_helpers.tpl index e3af42cb..9e6cccf9 100644 --- a/charts/mlp/templates/_helpers.tpl +++ b/charts/mlp/templates/_helpers.tpl @@ -57,9 +57,7 @@ Common labels {{- define "mlp.labels" -}} app.kubernetes.io/name: {{ template "mlp.name" . }} helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote}} -{{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ template "mlp.version" . }} -{{- end }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/part-of: caraml diff --git a/charts/turing/tests/turing_deployment_test.yaml b/charts/turing/tests/turing_deployment_test.yaml index 5882d392..a2bc517b 100644 --- a/charts/turing/tests/turing_deployment_test.yaml +++ b/charts/turing/tests/turing_deployment_test.yaml @@ -78,6 +78,7 @@ tests: - equal: # check database secret key path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.key value: secret-key + - it: should set releasedVersion as deployment image tag if deployment image tag is unset set: deployment: @@ -91,6 +92,29 @@ tests: - matchRegex: path: metadata.name pattern: my-release-turing$ - - equal: # check database secret name + - equal: # check image version path: spec.template.spec.containers[0].image value: ghcr.io/caraml-dev/turing:1.11.0-test-released-version + - equal: # check version label + path: spec.template.metadata.labels.version + value: 1.11.0-test-released-version + + - it: image tag must have precedence over releasedVersion + set: + deployment: + image: + tag: 1.11.0-test-image-tag + rendered: + releasedVersion: 1.11.0-test-released-version + asserts: + - isKind: + of: Deployment + - matchRegex: + path: metadata.name + pattern: my-release-turing$ + - equal: # check image version + path: spec.template.spec.containers[0].image + value: ghcr.io/caraml-dev/turing:1.11.0-test-image-tag + - equal: # check version label + path: spec.template.metadata.labels.version + value: 1.11.0-test-image-tag diff --git a/charts/xp-management/templates/_helpers.tpl b/charts/xp-management/templates/_helpers.tpl index 26693f8e..01bca6df 100644 --- a/charts/xp-management/templates/_helpers.tpl +++ b/charts/xp-management/templates/_helpers.tpl @@ -57,9 +57,7 @@ version: {{ template "management-svc.version" . }} release: {{ .Release.Name }} app.kubernetes.io/name: {{ template "management-svc.name" . }} helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote}} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} +app.kubernetes.io/version: {{ template "management-svc.version" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/part-of: caraml diff --git a/charts/xp-treatment/templates/_helpers.tpl b/charts/xp-treatment/templates/_helpers.tpl index a292ecce..be2aacb5 100644 --- a/charts/xp-treatment/templates/_helpers.tpl +++ b/charts/xp-treatment/templates/_helpers.tpl @@ -57,9 +57,7 @@ version: {{ template "treatment-svc.version" . }} release: {{ .Release.Name }} app.kubernetes.io/name: {{ template "treatment-svc.name" . }} helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote}} -{{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ template "treatment-svc.version" . }} -{{- end }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/part-of: caraml