From b2e69ed678d6f2f214925cd4f19bb286ceb3ceba Mon Sep 17 00:00:00 2001 From: Dmitrii Kabanov Date: Thu, 11 Apr 2019 15:20:07 -0700 Subject: [PATCH] Add possibility to check response code in auth test This PS allows to check the response code and if it's equal to 22, the test will be considered as successful. Change-Id: I3867c551be5785488248e956e6f8a124477232f5 --- charts/drydock/templates/tests/test-drydock-auth.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/drydock/templates/tests/test-drydock-auth.yaml b/charts/drydock/templates/tests/test-drydock-auth.yaml index 15b6f6d5..63ba3643 100644 --- a/charts/drydock/templates/tests/test-drydock-auth.yaml +++ b/charts/drydock/templates/tests/test-drydock-auth.yaml @@ -24,7 +24,7 @@ kind: Pod metadata: name: "{{ .Release.Name }}-auth-test" annotations: - helm.sh/hook: "test-failure" + helm.sh/hook: "test-success" {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} labels: {{ tuple $envAll "drydock" "auth-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} @@ -38,6 +38,6 @@ spec: image: {{ .Values.images.tags.drydock }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} - command: ["/bin/bash", "-c", "curl -v -X GET --fail ${DRYDOCK_URL}/api/v1.0/tasks; exit $?"] + command: ["/bin/bash", "-c", 'curl -v -X GET --fail ${DRYDOCK_URL}/api/v1.0/tasks; exit_code=$?; if [ "$exit_code" = "22" ]; then exit 0; fi; exit 1'] ... {{- end }}