mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-21 13:17:05 +00:00
Problem: Tests used `docker compose logs --since=5m` which caused:
- Log overlap between tests
- Logs from previous tests included
- Missing logs if test exceeded 5 minutes
Solution:
- New LogCollector class runs `docker compose logs --follow`
- Marks test start/end boundaries
- Writes test-specific logs to /tmp/test-{testId}-logs.txt
- Test steps access via TEST_ID environment variable
Changes:
- tests/src/log-collector.ts: New LogCollector class
- tests/src/executor.ts: Integrate LogCollector, set TEST_ID env
- tests/src/cli.ts: Start/stop LogCollector for runtime/inference
- All test cases: Use log collector with fallback to docker compose
Also updated docs/CICD.md with:
- Test runner CLI documentation
- Judge modes (simple, llm, dual)
- Log collector integration
- Updated test case list (12b, 27b models)
- Model unload strategy
- Troubleshooting guide
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
111 lines
3.4 KiB
YAML
111 lines
3.4 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: |
|
|
# Use log collector file if available, fallback to docker compose logs
|
|
if [ -f "/tmp/test-${TEST_ID}-logs.txt" ]; then
|
|
LOGS=$(cat /tmp/test-${TEST_ID}-logs.txt)
|
|
else
|
|
LOGS=$(cd docker && docker compose logs 2>&1)
|
|
fi
|
|
|
|
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: |
|
|
# Use log collector file if available, fallback to docker compose logs
|
|
if [ -f "/tmp/test-${TEST_ID}-logs.txt" ]; then
|
|
LOGS=$(cat /tmp/test-${TEST_ID}-logs.txt)
|
|
else
|
|
LOGS=$(cd docker && docker compose logs 2>&1)
|
|
fi
|
|
|
|
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: |
|
|
# Use log collector file if available, fallback to docker compose logs
|
|
if [ -f "/tmp/test-${TEST_ID}-logs.txt" ]; then
|
|
LOGS=$(cat /tmp/test-${TEST_ID}-logs.txt)
|
|
else
|
|
LOGS=$(cd docker && docker compose logs 2>&1)
|
|
fi
|
|
|
|
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.
|