From f4965f8a3ae40acb091ca624a86fbeafbff3dcc6 Mon Sep 17 00:00:00 2001 From: Ales Dumikau Date: Tue, 11 Apr 2023 12:24:46 +0300 Subject: [PATCH 1/2] Add tests to helm --- buildspec.yaml | 1 + helm/Chart.yaml | 2 +- helm/templates/tests/test-backend.yaml | 20 ++++++++++++++++++++ helm/templates/tests/test-frontend.yaml | 20 ++++++++++++++++++++ helm/templates/tests/test-mongo.yaml | 20 ++++++++++++++++++++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 helm/templates/tests/test-backend.yaml create mode 100644 helm/templates/tests/test-frontend.yaml create mode 100644 helm/templates/tests/test-mongo.yaml diff --git a/buildspec.yaml b/buildspec.yaml index 0c03513..afd5686 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -52,3 +52,4 @@ phases: - helm lint - helm template cid-checker-$NETWORK . -f env-values/$NETWORK.yaml - helm upgrade --install cid-checker-$NETWORK . -f env-values/$NETWORK.yaml + - helm test cid-checker-$NETWORK diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 3f9c912..9c44ebe 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -21,4 +21,4 @@ version: 0.0.2 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: 0.0.0 +appVersion: 0.1.30 diff --git a/helm/templates/tests/test-backend.yaml b/helm/templates/tests/test-backend.yaml new file mode 100644 index 0000000..0075626 --- /dev/null +++ b/helm/templates/tests/test-backend.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-test-backend" + annotations: + "helm.sh/hook": test +spec: + containers: + - name: test-backend + image: curlimages/curl + command: ['curl'] + args: + - --fail + - --write-out + - '%{http_code}' + - --silent + - --output + - /dev/null + - 'http://{{ include "CID.fullname" . }}-backend-service:3000/api/version' + restartPolicy: Never diff --git a/helm/templates/tests/test-frontend.yaml b/helm/templates/tests/test-frontend.yaml new file mode 100644 index 0000000..3624bcd --- /dev/null +++ b/helm/templates/tests/test-frontend.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-test-frontend" + annotations: + "helm.sh/hook": test +spec: + containers: + - name: test-frontend + image: curlimages/curl + command: ['curl'] + args: + - --fail + - --write-out + - '%{http_code}' + - --silent + - --output + - /dev/null + - 'http://{{ include "CID.fullname" . }}-frontend-service:80/' + restartPolicy: Never diff --git a/helm/templates/tests/test-mongo.yaml b/helm/templates/tests/test-mongo.yaml new file mode 100644 index 0000000..af98b91 --- /dev/null +++ b/helm/templates/tests/test-mongo.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-test-mongo" + annotations: + "helm.sh/hook": test +spec: + containers: + - name: test-mongo + image: curlimages/curl + command: ['curl'] + args: + - --fail + - --write-out + - '%{http_code}' + - --silent + - --output + - /dev/null + - 'http://{{ include "CID.fullname" . }}-backend-service:3000/api/deals/stats' + restartPolicy: Never From 363ed1c4c1c716d7532085fb67f8cbd216fed00f Mon Sep 17 00:00:00 2001 From: Ales Dumikau Date: Fri, 14 Apr 2023 15:39:24 +0300 Subject: [PATCH 2/2] Rollback appVersion --- helm/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 9c44ebe..3f9c912 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -21,4 +21,4 @@ version: 0.0.2 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: 0.1.30 +appVersion: 0.0.0