fix: tackling 502s
This commit is contained in:
@@ -43,18 +43,32 @@ jobs:
|
|||||||
|
|
||||||
- name: Register a user and check the status code
|
- name: Register a user and check the status code
|
||||||
run: |
|
run: |
|
||||||
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" 'http://localhost:3001/api/v1/register' \
|
MAX_RETRIES=30
|
||||||
-H 'Accept: */*' \
|
RETRY_INTERVAL=2
|
||||||
-H 'Accept-Language: en-US,en;q=0.9' \
|
|
||||||
-H 'Connection: keep-alive' \
|
for (( i=1; i<=$MAX_RETRIES; i++ ))
|
||||||
-H 'Content-Type: application/json' \
|
do
|
||||||
--data-raw '{"username":"demo@demo.io","password":"supercoolpassword"}')
|
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" 'http://localhost:3001/api/v1/register' \
|
||||||
if [ "$STATUS_CODE" -eq 200 ]; then
|
-H 'Accept: */*' \
|
||||||
echo "User registration was successful with status code 200."
|
-H 'Accept-Language: en-US,en;q=0.9' \
|
||||||
else
|
-H 'Connection: keep-alive' \
|
||||||
echo "User registration failed with status code $STATUS_CODE."
|
-H 'Content-Type: application/json' \
|
||||||
exit 1
|
--data-raw '{"username":"demo@demo.io","password":"supercoolpassword"}')
|
||||||
fi
|
|
||||||
|
if [ "$STATUS_CODE" -eq 200 ]; then
|
||||||
|
echo "User registration was successful with status code 200."
|
||||||
|
exit 0
|
||||||
|
elif [ "$STATUS_CODE" -ne 502 ]; then
|
||||||
|
echo "User registration failed with status code $STATUS_CODE."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Received status code 502. Retrying in $RETRY_INTERVAL seconds... ($i/$MAX_RETRIES)"
|
||||||
|
sleep $RETRY_INTERVAL
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "User registration failed after $MAX_RETRIES attempts."
|
||||||
|
exit 1
|
||||||
|
|
||||||
- name: Get the API key and run a health check
|
- name: Get the API key and run a health check
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user