Skip to content

Commit

Permalink
Update test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kadel authored Sep 12, 2024
1 parent 4d93243 commit 44d757c
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,9 @@ jobs:
- name: Build the Docker image
run: docker compose up -d
- name: Wait for HTTP 200 response
run: |
URL="https://localhost:7007"
TIMEOUT=240 # Max time to wait in seconds
SLEEP=5 # Time to wait between checks in seconds
start_time=$(date +%s)
while true; do
# Send a request to the URL and get the status code
STATUS=$(curl -o /dev/null -s -w "%{http_code}" "$URL")
# Check if the status code is 200
if [ "$STATUS" -eq 200 ]; then
echo "Success: HTTP 200 OK received from $URL"
exit 0
fi
# Check if the timeout has been exceeded
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
echo "Error: Timeout of $TIMEOUT seconds exceeded. Last status: $STATUS"
exit 1
fi
# Wait for a while before checking again
echo "Waiting for HTTP 200... Current status: $STATUS"
sleep "$SLEEP"
done
uses: cygnetdigital/[email protected]
with:
url: 'https://localhost:7007/'
responseCode: '200'
timeout: 2000
interval: 500

0 comments on commit 44d757c

Please sign in to comment.