30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""SearXNG Smoke-Test — NIGHTLY.
|
|
|
|
Minimal, schnell, read-only. Prueft die interne SearXNG-Instanz auf Erreichbarkeit
|
|
und JSON-Antwort. Genutzt wird die lokale Host-Route 127.0.0.1:8888 (kein Token
|
|
noetig, das Token-Gate sitzt nur in nginx/oeffentlich); damit bleibt der Test ohne
|
|
Secret. Faengt Totalausfaelle (Container down, API kaputt) ueber Nacht ab.
|
|
|
|
Bewusst KEIN "results nicht leer"-Assert: geratelimitete Upstream-Engines liefern
|
|
leere results (bekannter Degraded-Zustand, siehe /opt/searxng/README.md), das ist
|
|
kein Ausfall.
|
|
|
|
Lauf: /opt/mcp-servers/venv/bin/python -m pytest test_search_smoke.py -q
|
|
"""
|
|
|
|
import httpx
|
|
import pytest
|
|
|
|
pytestmark = pytest.mark.smoke
|
|
|
|
BASE = "http://127.0.0.1:8888"
|
|
|
|
|
|
def test_searxng_json_alive():
|
|
"""SearXNG erreichbar und liefert eine JSON-Antwort mit results-Liste."""
|
|
r = httpx.get(f"{BASE}/search", params={"q": "polo smoke", "format": "json"}, timeout=30)
|
|
assert r.status_code == 200, f"SearXNG HTTP {r.status_code}"
|
|
data = r.json()
|
|
assert isinstance(data.get("results"), list), "SearXNG JSON ohne results-Liste"
|