Skip to content

Commit

Permalink
Fail if 'Serving on port' was not found within 60 seconds of polling …
Browse files Browse the repository at this point in the history
…COMPLETE log file. Print error, fail workflow, and print container log that lacked the required string
  • Loading branch information
david-rocca committed Oct 22, 2024
1 parent d9a77ee commit 786cfce
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,23 @@ jobs:
docker compose --file docker/docker-compose.yml build
docker compose --file docker/docker-compose.yml up -d
- name: Sleep
run: bash -c "while ! docker compose --file docker/docker-compose.yml logs --tail=10 cveawg | grep -q 'Serving on port'; do sleep 1; done"
run: |
set -e
set -x
set -o pipefail
dockercompose="docker compose --file docker/docker-compose.yml"
attempts=60
while ! $dockercompose logs cveawg | grep -q 'Serving on port'; do
attempts=$(expr $attempts - 1)
if [ $($dockercompose ps --status running -q) -eq 2 ] && [ $attempts -gt 0 ]; then
sleep 1
continue
fi
$dockercompose ps || true
$dockercompose logs || true
echo "==== COULD NOT FIND 'Serving on port' in cveawg output OR one of the services died ====" 1>&2
exit 1
done
- name: Run Tests
run: docker compose -f docker/docker-compose.yml exec -T cveawg npm run test:integration
continue-on-error: false

0 comments on commit 786cfce

Please sign in to comment.