Skip to content

Commit a2ed0e5

Browse files
committed
ci: Wait for server readiness in tests
1 parent 8380f24 commit a2ed0e5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,26 @@ jobs:
4242
bun run --bun validate
4343
4444
- name: Validate some requests
45+
shell: bash
4546
run: |
47+
set -euo pipefail
4648
cd server
4749
bun run start &
48-
sleep 10
49-
cd ../.bruno
50+
SERVER_PID=$!
51+
cd ..
52+
53+
ATTEMPTS=0
54+
until curl -sSf http://127.0.0.1:3000/status > /dev/null; do
55+
ATTEMPTS=$((ATTEMPTS + 1))
56+
if [ $ATTEMPTS -ge 60 ]; then
57+
echo "Server did not become ready within 60 seconds" >&2
58+
kill $SERVER_PID
59+
exit 1
60+
fi
61+
sleep 1
62+
done
63+
64+
cd .bruno
5065
bru run --env Developpement
66+
67+
kill $SERVER_PID

0 commit comments

Comments
 (0)