From 6a7a6373d8d563fa4afb5f8c75084b80173ed23d Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Sun, 1 Dec 2024 21:50:30 -0500 Subject: [PATCH 1/2] fix(tests): correct syntax for all tests --- charts/supabase/templates/test/analytics.yaml | 4 +++- charts/supabase/templates/test/auth.yaml | 4 +++- charts/supabase/templates/test/db.yaml | 5 ++++- charts/supabase/templates/test/imgproxy.yaml | 4 +++- charts/supabase/templates/test/kong.yaml | 3 ++- charts/supabase/templates/test/meta.yaml | 4 +++- charts/supabase/templates/test/minio.yaml | 4 +++- charts/supabase/templates/test/realtime.yaml | 4 +++- charts/supabase/templates/test/rest.yaml | 4 +++- charts/supabase/templates/test/storage.yaml | 4 +++- charts/supabase/templates/test/studio.yaml | 4 +++- 11 files changed, 33 insertions(+), 11 deletions(-) diff --git a/charts/supabase/templates/test/analytics.yaml b/charts/supabase/templates/test/analytics.yaml index b97c3408..ff4b1743 100644 --- a/charts/supabase/templates/test/analytics.yaml +++ b/charts/supabase/templates/test/analytics.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.analytics.fullname" . }}:{{ .Values.analytics.service.port }}/health + http://{{ include "supabase.analytics.fullname" . }}:{{ .Values.analytics.service.port }}/health \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.analytics.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.analytics.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/auth.yaml b/charts/supabase/templates/test/auth.yaml index 19a7fb1f..950b0b06 100644 --- a/charts/supabase/templates/test/auth.yaml +++ b/charts/supabase/templates/test/auth.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.auth.fullname" . }}:{{ .Values.auth.service.port }}/health + http://{{ include "supabase.auth.fullname" . }}:{{ .Values.auth.service.port }}/health \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.auth.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.auth.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/db.yaml b/charts/supabase/templates/test/db.yaml index 296bcc3b..f8834027 100644 --- a/charts/supabase/templates/test/db.yaml +++ b/charts/supabase/templates/test/db.yaml @@ -16,9 +16,12 @@ spec: - /bin/sh - -c - | - pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER) || $(echo "\e[0;31mFailed to connect to the database." && exit 1) + pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER) \ + || { echo -e "\033[31mFailed to connect to the database."; exit 1; } + echo "Database is ready" env: + # no password? - name: DB_HOST {{- if .Values.db.enabled }} value: {{ include "supabase.db.fullname" . | quote }} diff --git a/charts/supabase/templates/test/imgproxy.yaml b/charts/supabase/templates/test/imgproxy.yaml index b283dc8a..8a2639b0 100644 --- a/charts/supabase/templates/test/imgproxy.yaml +++ b/charts/supabase/templates/test/imgproxy.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.imgproxy.fullname" . }}:{{ .Values.imgproxy.service.port }}/health + http://{{ include "supabase.imgproxy.fullname" . }}:{{ .Values.imgproxy.service.port }}/health \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.imgproxy.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.imgproxy.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/kong.yaml b/charts/supabase/templates/test/kong.yaml index f8c741f8..f9db82d8 100644 --- a/charts/supabase/templates/test/kong.yaml +++ b/charts/supabase/templates/test/kong.yaml @@ -34,7 +34,8 @@ spec: curl -sL --fail \ -o /dev/null \ "http://${DASHBOARD_USERNAME}:${DASHBOARD_PASSWORD}@{{ include "supabase.kong.fullname" . }}:{{ .Values.kong.service.port }}" \ - || ( echo -e "\e[0;31mFailed to get a valid response." && exit 1 ) + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.kong.fullname" . }}."; exit 1; } + echo "Successfully connected." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/meta.yaml b/charts/supabase/templates/test/meta.yaml index 9aee7f54..22d053fa 100644 --- a/charts/supabase/templates/test/meta.yaml +++ b/charts/supabase/templates/test/meta.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.meta.fullname" . }}:{{ .Values.meta.service.port }}/health + http://{{ include "supabase.meta.fullname" . }}:{{ .Values.meta.service.port }}/health \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.meta.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.meta.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/minio.yaml b/charts/supabase/templates/test/minio.yaml index b3c3db27..c07a9820 100644 --- a/charts/supabase/templates/test/minio.yaml +++ b/charts/supabase/templates/test/minio.yaml @@ -19,7 +19,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.minio.fullname" . }}:{{ .Values.minio.service.port }}/minio/health/live + http://{{ include "supabase.minio.fullname" . }}:{{ .Values.minio.service.port }}/minio/health/live \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.minio.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.minio.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/realtime.yaml b/charts/supabase/templates/test/realtime.yaml index e373fde8..e547ecb5 100644 --- a/charts/supabase/templates/test/realtime.yaml +++ b/charts/supabase/templates/test/realtime.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.realtime.fullname" . }}:{{ .Values.realtime.service.port }} + http://{{ include "supabase.realtime.fullname" . }}:{{ .Values.realtime.service.port }} \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.realtime.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.realtime.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/rest.yaml b/charts/supabase/templates/test/rest.yaml index 927ffc73..1a7e2667 100644 --- a/charts/supabase/templates/test/rest.yaml +++ b/charts/supabase/templates/test/rest.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.rest.fullname" . }}:{{ .Values.rest.service.port }} + http://{{ include "supabase.rest.fullname" . }}:{{ .Values.rest.service.port }} \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.rest.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.rest.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/storage.yaml b/charts/supabase/templates/test/storage.yaml index db129fff..ffe4e43a 100644 --- a/charts/supabase/templates/test/storage.yaml +++ b/charts/supabase/templates/test/storage.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.storage.fullname" . }}:{{ .Values.storage.service.port }}/status + http://{{ include "supabase.storage.fullname" . }}:{{ .Values.storage.service.port }}/status \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.storage.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.storage.fullname" . }} is healthy." restartPolicy: Never {{- end }} diff --git a/charts/supabase/templates/test/studio.yaml b/charts/supabase/templates/test/studio.yaml index 7e5082d9..d393ce9c 100644 --- a/charts/supabase/templates/test/studio.yaml +++ b/charts/supabase/templates/test/studio.yaml @@ -20,7 +20,9 @@ spec: - -c - | curl -sfo /dev/null \ - http://{{ include "supabase.studio.fullname" . }}:{{ .Values.studio.service.port }}/api/profile + http://{{ include "supabase.studio.fullname" . }}:{{ .Values.studio.service.port }}/api/profile \ + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.studio.fullname" . }}."; exit 1; } + echo "Sevice {{ include "supabase.studio.fullname" . }} is healthy." restartPolicy: Never {{- end }} From 2f1d7047efdfd11a94b0f35c650108904785f5e8 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Mon, 2 Dec 2024 09:58:04 -0500 Subject: [PATCH 2/2] fix(tests): restore terminal color at end of error messages --- charts/supabase/templates/test/analytics.yaml | 2 +- charts/supabase/templates/test/auth.yaml | 2 +- charts/supabase/templates/test/db.yaml | 2 +- charts/supabase/templates/test/imgproxy.yaml | 2 +- charts/supabase/templates/test/kong.yaml | 2 +- charts/supabase/templates/test/meta.yaml | 2 +- charts/supabase/templates/test/minio.yaml | 2 +- charts/supabase/templates/test/realtime.yaml | 2 +- charts/supabase/templates/test/rest.yaml | 2 +- charts/supabase/templates/test/storage.yaml | 2 +- charts/supabase/templates/test/studio.yaml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/charts/supabase/templates/test/analytics.yaml b/charts/supabase/templates/test/analytics.yaml index ff4b1743..c90df374 100644 --- a/charts/supabase/templates/test/analytics.yaml +++ b/charts/supabase/templates/test/analytics.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.analytics.fullname" . }}:{{ .Values.analytics.service.port }}/health \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.analytics.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.analytics.fullname" . }}\033[0m."; exit 1; } echo "Sevice {{ include "supabase.analytics.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/auth.yaml b/charts/supabase/templates/test/auth.yaml index 950b0b06..799ba984 100644 --- a/charts/supabase/templates/test/auth.yaml +++ b/charts/supabase/templates/test/auth.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.auth.fullname" . }}:{{ .Values.auth.service.port }}/health \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.auth.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.auth.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.auth.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/db.yaml b/charts/supabase/templates/test/db.yaml index f8834027..ed54d787 100644 --- a/charts/supabase/templates/test/db.yaml +++ b/charts/supabase/templates/test/db.yaml @@ -17,7 +17,7 @@ spec: - -c - | pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER) \ - || { echo -e "\033[31mFailed to connect to the database."; exit 1; } + || { echo -e "\033[31mFailed to connect to the database.\033[0m"; exit 1; } echo "Database is ready" env: diff --git a/charts/supabase/templates/test/imgproxy.yaml b/charts/supabase/templates/test/imgproxy.yaml index 8a2639b0..be1d2ab0 100644 --- a/charts/supabase/templates/test/imgproxy.yaml +++ b/charts/supabase/templates/test/imgproxy.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.imgproxy.fullname" . }}:{{ .Values.imgproxy.service.port }}/health \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.imgproxy.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.imgproxy.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.imgproxy.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/kong.yaml b/charts/supabase/templates/test/kong.yaml index f9db82d8..dbefc40a 100644 --- a/charts/supabase/templates/test/kong.yaml +++ b/charts/supabase/templates/test/kong.yaml @@ -34,7 +34,7 @@ spec: curl -sL --fail \ -o /dev/null \ "http://${DASHBOARD_USERNAME}:${DASHBOARD_PASSWORD}@{{ include "supabase.kong.fullname" . }}:{{ .Values.kong.service.port }}" \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.kong.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.kong.fullname" . }}.\033[0m"; exit 1; } echo "Successfully connected." restartPolicy: Never diff --git a/charts/supabase/templates/test/meta.yaml b/charts/supabase/templates/test/meta.yaml index 22d053fa..af298b80 100644 --- a/charts/supabase/templates/test/meta.yaml +++ b/charts/supabase/templates/test/meta.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.meta.fullname" . }}:{{ .Values.meta.service.port }}/health \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.meta.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.meta.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.meta.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/minio.yaml b/charts/supabase/templates/test/minio.yaml index c07a9820..9798b967 100644 --- a/charts/supabase/templates/test/minio.yaml +++ b/charts/supabase/templates/test/minio.yaml @@ -20,7 +20,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.minio.fullname" . }}:{{ .Values.minio.service.port }}/minio/health/live \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.minio.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.minio.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.minio.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/realtime.yaml b/charts/supabase/templates/test/realtime.yaml index e547ecb5..acc33b37 100644 --- a/charts/supabase/templates/test/realtime.yaml +++ b/charts/supabase/templates/test/realtime.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.realtime.fullname" . }}:{{ .Values.realtime.service.port }} \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.realtime.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.realtime.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.realtime.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/rest.yaml b/charts/supabase/templates/test/rest.yaml index 1a7e2667..4b23f923 100644 --- a/charts/supabase/templates/test/rest.yaml +++ b/charts/supabase/templates/test/rest.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.rest.fullname" . }}:{{ .Values.rest.service.port }} \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.rest.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.rest.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.rest.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/storage.yaml b/charts/supabase/templates/test/storage.yaml index ffe4e43a..1db4fc26 100644 --- a/charts/supabase/templates/test/storage.yaml +++ b/charts/supabase/templates/test/storage.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.storage.fullname" . }}:{{ .Values.storage.service.port }}/status \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.storage.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.storage.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.storage.fullname" . }} is healthy." restartPolicy: Never diff --git a/charts/supabase/templates/test/studio.yaml b/charts/supabase/templates/test/studio.yaml index d393ce9c..78e370b3 100644 --- a/charts/supabase/templates/test/studio.yaml +++ b/charts/supabase/templates/test/studio.yaml @@ -21,7 +21,7 @@ spec: - | curl -sfo /dev/null \ http://{{ include "supabase.studio.fullname" . }}:{{ .Values.studio.service.port }}/api/profile \ - || { echo -e "\033[31mFailed to connect to the {{ include "supabase.studio.fullname" . }}."; exit 1; } + || { echo -e "\033[31mFailed to connect to the {{ include "supabase.studio.fullname" . }}.\033[0m"; exit 1; } echo "Sevice {{ include "supabase.studio.fullname" . }} is healthy." restartPolicy: Never