Files
Matteo Benedetto 70f3699396 test: suite pytest per il gateway (21 test) + script di verifica pre-push
- conftest: FakeQdrant in-memory + mock embed (nessuna dipendenza da Qdrant/Ollama)
- test: validazione (project_id, kind, expires_at, confidence, lunghezza), auth (422/401/429), idempotency (replay/409/key diverse), supersede (404/409/lineage), filtri search, meta, status, metrics
- scripts/check.sh: esbuild (estensione) + pytest (gateway)
- requirements-dev.txt: pytest
2026-08-16 19:53:45 +02:00

19 lines
691 B
Bash
Executable File

#!/usr/bin/env bash
# Verifica pre-push di pi-qmem: sintassi estensione (esbuild) + test gateway (pytest).
# Uso: ./scripts/check.sh (richiede: npx esbuild, python3 con pytest + deps gateway)
set -euo pipefail
cd "$(dirname "$0")/.."
echo "── 1/2 Estensione: transpile esbuild ──"
npx --no-install esbuild extensions/index.ts --outfile=/tmp/qmem-check.mjs
echo "✅ estensione OK"
echo "── 2/2 Gateway: pytest ──"
cd gateway
if ! python3 -c "import pytest, fastapi, qdrant_client, httpx, pydantic" 2>/dev/null; then
echo "⚠️ dipendenze mancanti: pip install -r requirements.txt -r requirements-dev.txt"
exit 1
fi
python3 -m pytest tests/ -q
echo "✅ gateway OK"