harden: per-item robustness + deadlines/caps across connectors; layered tests

Mail: _safe_decode + _iter_messages (per-mail try/except) -> eine kaputte Mail
(charset x-unknown) bricht die Suche nicht mehr ab, findet so auch uralte Mails.
Vollscan + Datum-Sort + MAX_SCAN/DEADLINE_S (Selbstheilung, kein 24h-Haenger mehr).

Files: search_files mit SEARCH_DEADLINE_S + SEARCH_MAX_DIRS begrenzt (war
unbegrenzte rekursive PROPFIND -> real 35s/449 Calls).

Calendar/Contacts: PARSE_DEADLINE_S fuer client-seitiges vobject-Parsen;
MAX_RESULTS-Output-Cap in get_events/get_tasks (war 10939 Zeilen bei 6000 Events);
search Top-N + Hinweise.

Tests: in Schichten getrennt -> Smoke (nightly), Edge + Stress (on-demand).
Neu: test_smoke/test_edge/test_stress + conftest-Marker + run_full_tests.sh,
nightly laeuft nur Smoke. Kontakt-Foto-Roundtrip-Test, Mail-Edge-Mails
(x-unknown, kaputter Header, 2009er Alt-Mail).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Lohmaier
2026-06-24 21:17:26 +02:00
co-authored by Claude Opus 4.8
parent 936ebc2f56
commit c9ccb4392b
26 changed files with 719 additions and 65 deletions
+8 -6
View File
@@ -1,25 +1,27 @@
#!/bin/bash
# MCP Server Integration Tests — laeuft taeglich via systemd timer
# MCP Smoke-Tests — laeuft taeglich via systemd timer (mcp-tests.timer 05:00).
# NUR Smoke (Server up + Auth + 1 Read/Connector). Stress/Edge/Funktional laufen
# NICHT naechtlich -> on-demand via run_full_tests.sh.
set -uo pipefail
LOG="/var/log/mcp-tests.log"
NTFY_TOPIC="admin"
VENV="/opt/mcp-servers/venv/bin"
echo "[$(date)] MCP Tests gestartet" | tee -a "$LOG"
echo "[$(date)] MCP Smoke-Tests gestartet" | tee -a "$LOG"
OUTPUT=$($VENV/python -m pytest /opt/mcp-servers/tests/test_all.py -v --tb=short 2>&1)
OUTPUT=$(cd /opt/mcp-servers/tests && $VENV/python -m pytest test_smoke.py -v --tb=short 2>&1)
EXIT=$?
echo "$OUTPUT" | tee -a "$LOG"
if [ $EXIT -eq 0 ]; then
PASSED=$(echo "$OUTPUT" | grep -oP '\d+ passed' | head -1)
echo "[$(date)] MCP Tests OK: $PASSED" | tee -a "$LOG"
echo "[$(date)] MCP Smoke-Tests OK: $PASSED" | tee -a "$LOG"
else
FAILED=$(echo "$OUTPUT" | grep "FAILED" | head -5)
echo "[$(date)] MCP Tests FEHLGESCHLAGEN" | tee -a "$LOG"
/usr/local/bin/notify-ntfy "$NTFY_TOPIC" "MCP Tests fehlgeschlagen" \
echo "[$(date)] MCP Smoke-Tests FEHLGESCHLAGEN" | tee -a "$LOG"
/usr/local/bin/notify-ntfy "$NTFY_TOPIC" "MCP Smoke-Tests fehlgeschlagen" \
"$(echo "$FAILED" | head -3)\n\nLog: tail -50 $LOG" "urgent" "x,test_tube"
fi