File size: 1,378 Bytes
b657fcc |
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 |
"""Integration test script: attempts to connect to Neo4j and Faiss index.
This script is safe: it catches missing libraries and reports status.
"""
import sys
import traceback
def try_neo4j():
try:
from backend.adapters.graph_adapter import Neo4jAdapter
print("Neo4jAdapter loaded")
a = Neo4jAdapter()
if not a.is_available():
print("Neo4j driver not available or connection not established")
return
# create test node
res = a.run("CREATE (n:Test {name:$name}) RETURN id(n) as id", name="integration_test")
print("Neo4j create node result:", res)
a.close()
except Exception as e:
print("Neo4j test failed:")
traceback.print_exc()
def try_faiss():
try:
from backend.adapters.vector_adapter_full import FaissIndex
print("FaissIndex available")
dim = 32
idx = FaissIndex(dim)
vec = [float(i) for i in range(dim)]
idx.upsert("u1", vec)
results = idx.search(vec, top_k=1)
print("Faiss search results:", results)
except Exception as e:
print("Faiss test failed or faiss not installed:")
traceback.print_exc()
def main():
print("Running integration tests...")
try_neo4j()
try_faiss()
if __name__ == '__main__':
main()
|