31 lines
1.2 KiB
Bash
Executable File
31 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# MCP Smoke-Tests — laeuft taeglich via systemd timer (mcp-tests.timer 05:00).
|
|
# NUR Smoke (Server up + Auth + 1 Read/Connector) plus SearXNG-Smoke
|
|
# (test_search_smoke.py, lokale Route 127.0.0.1:8888) plus oeffentlicher Smoke
|
|
# (test_public_smoke.py, Route/TLS/Bearer ueber https://<name>.mcp.slohmaier.de).
|
|
# 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 test_public_smoke.py test_search_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
|