#!/bin/bash # 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 Smoke-Tests gestartet" | tee -a "$LOG" 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 Smoke-Tests OK: $PASSED" | tee -a "$LOG" else FAILED=$(echo "$OUTPUT" | grep "FAILED" | head -5) 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 exit $EXIT