Skip to content

Commit 735ab96

Browse files
committed
feat(tests): add readiness check for app before running tests
1 parent 180d298 commit 735ab96

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/api_test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ jobs:
2626
- name: Start services
2727
run: docker compose up -d --build --wait
2828

29+
- name: Wait for app to be ready
30+
run: |
31+
for i in {1..30}; do
32+
if docker compose exec app uv run python -c "import requests; requests.get('http://localhost:8000/metric', timeout=2)" 2>/dev/null; then
33+
echo "✅ App is ready"
34+
exit 0
35+
fi
36+
echo "Waiting for app... ($i/30)"
37+
sleep 2
38+
done
39+
echo "❌ App failed to start"
40+
docker compose logs app
41+
exit 1
42+
2943
- name: Run API test
3044
run: docker compose exec app uv run python tests/shorten.py
3145

0 commit comments

Comments
 (0)