mirror of
http://100.103.83.12:3003/fegger/pv-agent.git
synced 2026-09-17 16:06:23 +00:00
feat(agent): harden API-first service
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""Tests: Hybrid-Retrieval (BM25-only offline): Fusion, Entry-Dedup,
|
||||
cross_ref-Erweiterung, leeres Retrieval."""
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
import pytest
|
||||
|
||||
from agent.retrieve import Retriever
|
||||
@@ -62,6 +64,14 @@ def test_recency_boost_prefers_newer_stand(retriever):
|
||||
assert main[0].entry_id in {"lb-min-01", "lb-min-02"}
|
||||
|
||||
|
||||
def test_shared_retriever_is_safe_across_worker_threads(retriever):
|
||||
"""FastAPI darf dieselbe Retriever-Instanz in mehreren Threads nutzen."""
|
||||
questions = ["Altersteilzeit Lohnausgleich", "Urlaubsanspruch Werktage"] * 4
|
||||
with ThreadPoolExecutor(max_workers=4) as pool:
|
||||
result_sets = list(pool.map(retriever.search, questions))
|
||||
assert all(results for results in result_sets)
|
||||
|
||||
|
||||
def test_stats_report(mini_index):
|
||||
r = Retriever(mini_index)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user