File size: 1,271 Bytes
7248d39 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | """Integration test script — run when FAISS store and models are available.
Usage:
cd backend
python scripts/integration_test.py
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
def test_health():
import httpx
try:
r = httpx.get("http://localhost:8000/health", timeout=5)
assert r.status_code == 200
print("[OK] Backend health check")
except Exception as e:
print(f"[SKIP] Backend not running: {e}")
def test_faiss():
from db.faiss_client import FaissDB
db = FaissDB()
db.list_documents()
print("[OK] FAISS store ready")
db.close()
def test_embedder():
print("Embedder runs on Modal — run: python scripts/test_embedder.py")
def main():
print("FinSight AI Integration Tests")
print("=" * 40)
try:
test_faiss()
except Exception as e:
print(f"[FAIL] FAISS: {e}")
return 1
try:
test_embedder()
except Exception as e:
print(f"[SKIP] Embedder (Modal): {e}")
print(" -> Deploy with: modal deploy finsight_modal/app.py")
test_health()
print("=" * 40)
print("Core integration tests passed.")
return 0
if __name__ == "__main__":
sys.exit(main())
|