From 1f5223c01d75c1c59d431d316314fe0db8094480 Mon Sep 17 00:00:00 2001 From: Sumesh Pradhan Date: Fri, 25 Aug 2023 15:27:48 +0530 Subject: [PATCH] ci: docDB int test wait for appsmith health before cypress (#26655) --- .github/workflows/ci-test-with-documentdb.yml | 4 ++++ scripts/health_check.sh | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 scripts/health_check.sh diff --git a/.github/workflows/ci-test-with-documentdb.yml b/.github/workflows/ci-test-with-documentdb.yml index 89250b37db..48529c7dab 100644 --- a/.github/workflows/ci-test-with-documentdb.yml +++ b/.github/workflows/ci-test-with-documentdb.yml @@ -331,6 +331,10 @@ jobs: echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV fi + - name: Wait until appsmith server is healthy + run: | + bash scripts/health_check.sh + - name: Run the cypress test if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest' id: cypress_test diff --git a/scripts/health_check.sh b/scripts/health_check.sh new file mode 100644 index 0000000000..ee869f418b --- /dev/null +++ b/scripts/health_check.sh @@ -0,0 +1,13 @@ +#!/bin/bash +endpoint="http://localhost/api/v1/health" +status_code=0 + +while [ $status_code -ne 200 ]; do + response=$(curl -s -o /dev/null -w "%{http_code}" "$endpoint") + status_code=$response + + if [ $status_code -ne 200 ]; then + echo "Response status code: $status_code. Retrying..." + sleep 30 + fi +done