Skip to content

Commit 45bba6f

Browse files
committed
Enhance API health check and desktop snapshot tests with detailed debug logging and retry logic
1 parent b1c1835 commit 45bba6f

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/test-dynamic-method.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,23 @@ jobs:
175175
echo "Waiting for API services to be ready..."
176176
sleep 20
177177
api_success=0
178+
set -x # Enable debug mode to show commands being executed
179+
180+
# Debug container status
181+
echo "DEBUG: Container status before health check:"
182+
docker ps
178183
179184
# Test health endpoint with retry
180185
echo "Testing health endpoint..."
181186
for attempt in {1..10}; do
182-
if curl -f http://localhost:5000/snapshot-info -s > /dev/null; then
187+
echo "DEBUG: Attempting health check $attempt"
188+
health_status=$(curl -f -s -w "%{http_code}" http://localhost:5000/snapshot-info -o /dev/null || echo "failed")
189+
echo "DEBUG: Health check status code: $health_status"
190+
191+
if [[ "$health_status" == "200" ]]; then
183192
echo "✅ Health check passed on attempt $attempt"
184193
((api_success++))
194+
echo "DEBUG: api_success value is now $api_success"
185195
break
186196
else
187197
echo "⏳ Health check attempt $attempt failed, retrying..."
@@ -196,27 +206,41 @@ jobs:
196206
197207
# Test desktop snapshot with retry
198208
echo "Testing desktop snapshot..."
209+
echo "DEBUG: Starting desktop snapshot test"
199210
for attempt in {1..5}; do
200-
if curl -f http://localhost:5000/desktop-snapshot -o /dev/null; then
211+
echo "DEBUG: Attempting desktop snapshot $attempt"
212+
snapshot_status=$(curl -f -s -w "%{http_code}" http://localhost:5000/desktop-snapshot -o /dev/null || echo "failed")
213+
echo "DEBUG: Snapshot status code: $snapshot_status"
214+
215+
if [[ "$snapshot_status" == "200" ]]; then
201216
echo "✅ Desktop snapshot passed on attempt $attempt"
202217
((api_success++))
218+
echo "DEBUG: api_success value is now $api_success"
203219
break
204220
else
205221
echo "⏳ Desktop snapshot attempt $attempt failed, retrying..."
206222
if [ $attempt -eq 5 ]; then
207223
echo "❌ Desktop snapshot failed after 5 attempts"
224+
echo "DEBUG: Container status after desktop snapshot failure:"
225+
docker ps
226+
echo "DEBUG: Checking container logs for API issues:"
227+
docker logs --tail 20 wow-clients-client-1 2>&1 || echo "No logs available"
208228
fi
209229
sleep 5
210230
fi
211231
done
212232
233+
echo "DEBUG: Final api_success value: $api_success"
213234
if [ $api_success -eq 2 ]; then
235+
echo "DEBUG: All tests passed, setting output to PASS"
214236
echo "result=PASS" >> $GITHUB_OUTPUT
215237
echo "message=All API tests passed (2/2)" >> $GITHUB_OUTPUT
216238
else
239+
echo "DEBUG: Some tests failed, setting output to PARTIAL"
217240
echo "result=PARTIAL" >> $GITHUB_OUTPUT
218241
echo "message=API tests partially passed ($api_success/2)" >> $GITHUB_OUTPUT
219242
fi
243+
set +x # Disable debug mode
220244
221245
- name: Run API Test Script
222246
id: test-api-script

0 commit comments

Comments
 (0)