Files
mcp-home/tests/run_tests.sh
T
Stefan Lohmaier 2618ecfc86 Add test client and automated integration test suite
- 'test' OAuth client maps to stefan's data via USER_ALIASES
- 38 tests covering OAuth (metadata, client_credentials, PKCE, invalid
  secret, no auth), Mail (accounts, folders, search), Calendar
  (calendars, tasks, events, search), Contacts (search, empty),
  Files (list, info), Notes (notebooks)
- Daily systemd timer (05:00) with NTFY notification on failure
- Shared token store (.active_tokens.json) for cross-process auth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-12 10:33:01 +02:00

27 lines
804 B
Bash
Executable File

#!/bin/bash
# MCP Server Integration Tests — laeuft taeglich via systemd timer
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"
OUTPUT=$($VENV/python -m pytest /opt/mcp-servers/tests/test_all.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"
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 "$FAILED" | head -3)\n\nLog: tail -50 $LOG" "urgent" "x,test_tube"
fi
exit $EXIT