Wait for server to start before Cypress tests (#5846)

This commit is contained in:
yatinappsmith 2021-07-14 16:40:48 +05:30 committed by GitHub
parent dcfb8f6e48
commit 5edd9d0fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -333,7 +333,11 @@ jobs:
APPSMITH_ENCRYPTION_SALT: "salt"
APPSMITH_IS_SELF_HOSTED: false
run: |
./scripts/start-dev-server.sh > /dev/null 2>&1 &
./scripts/start-dev-server.sh > /dev/null 2>&1 &
- name: Wait for 30 seconds for server to start
run: sleep 30s
shell: bash
- name: Use Node.js 14.15.4
uses: actions/setup-node@v1

View File

@ -41,6 +41,23 @@ sleep 30
echo "Checking if the containers have started"
sudo docker ps -a
echo "Checking if the server has started"
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" https://dev.appsmith.com/api/v1/users)
retry_count=1
while [ "$retry_count" -le "3" -a "$status_code" -eq "502" ]; do
echo "Hit 502.Server not started retrying..."
retry_count=$((1 + $retry_count))
sleep 30
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" https://dev.appsmith.com/api/v1/users)
done
if [ "$status_code" -eq "502" ]; then
echo "Unable to connect to server"
exit 1
fi
# Create the test user
curl -k --request POST -v 'https://dev.appsmith.com/api/v1/users' \
--header 'Content-Type: application/json' \