Files
ollama37/tests/testcases/runtime/TC-RUNTIME-003.yml
Shang Chieh Tseng ce2882b757 Fix runtime test log checks that require model loading
- Remove CUDA initialization checks from TC-RUNTIME-002 (ggml_cuda_init,
  load_backend only appear when a model is loaded, not at startup)
- Fix bash integer comparison error in TC-RUNTIME-003

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 00:00:24 +08:00

99 lines
2.8 KiB
YAML

id: TC-RUNTIME-003
name: Health Check
suite: runtime
priority: 3
timeout: 180000
dependencies:
- TC-RUNTIME-001
steps:
- name: Wait for health check
command: |
for i in {1..30}; do
STATUS=$(docker inspect ollama37 --format='{{.State.Health.Status}}' 2>/dev/null || echo "starting")
echo "Health status: $STATUS (attempt $i/30)"
if [ "$STATUS" = "healthy" ]; then
echo "Container is healthy"
exit 0
fi
sleep 5
done
echo "Health check timeout"
exit 1
- name: Test API endpoint
command: curl -s http://localhost:11434/api/tags
- name: Check Ollama version
command: docker exec ollama37 ollama --version
- name: Verify server listening in logs
command: |
cd docker
LOGS=$(docker compose logs 2>&1)
echo "=== Server Status Check ==="
# Check server is listening
if echo "$LOGS" | grep -q "Listening on"; then
echo "SUCCESS: Server is listening"
echo "$LOGS" | grep "Listening on" | head -1
else
echo "ERROR: Server not listening"
exit 1
fi
- name: Check for runtime errors in logs
command: |
cd docker
LOGS=$(docker compose logs 2>&1)
echo "=== Runtime Error Check ==="
# Check for any ERROR level logs
ERROR_COUNT=$(echo "$LOGS" | grep -c "level=ERROR" || true)
if [ -n "$ERROR_COUNT" ] && [ "$ERROR_COUNT" -gt 0 ] 2>/dev/null; then
echo "WARNING: Found $ERROR_COUNT ERROR level log entries:"
echo "$LOGS" | grep "level=ERROR" | tail -5
else
echo "SUCCESS: No ERROR level logs found"
fi
# Check for panic/fatal
if echo "$LOGS" | grep -qiE "(panic|fatal)"; then
echo "CRITICAL: Panic or fatal error detected:"
echo "$LOGS" | grep -iE "(panic|fatal)"
exit 1
fi
echo "SUCCESS: No critical runtime errors"
- name: Verify API request handling in logs
command: |
cd docker
LOGS=$(docker compose logs 2>&1)
echo "=== API Request Logs ==="
# Check that API requests are being logged (GIN framework)
if echo "$LOGS" | grep -q '\[GIN\].*200.*GET.*"/api/tags"'; then
echo "SUCCESS: API requests are being handled"
echo "$LOGS" | grep '\[GIN\].*"/api/tags"' | tail -3
else
echo "WARNING: No API request logs found (might be first request)"
fi
criteria: |
Ollama server should be healthy and API responsive.
Expected:
- Container health status becomes "healthy"
- /api/tags endpoint returns JSON response (even if empty models)
- ollama --version shows version information
- Logs show "Listening on" message
- No panic or fatal errors in logs
- API requests logged with 200 status codes
Accept any valid JSON response from API. Version format may vary.