mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-24 21:38:09 +02:00
update index batch parallel tests
This commit is contained in:
parent
aca23b4731
commit
a8a1f01945
1 changed files with 22 additions and 5 deletions
|
|
@ -65,10 +65,18 @@ async def test_index_calls_embed_and_chunk_via_to_thread(
|
||||||
"app.indexing_pipeline.cache.cached_indexing.embed_texts",
|
"app.indexing_pipeline.cache.cached_indexing.embed_texts",
|
||||||
mock_embed,
|
mock_embed,
|
||||||
)
|
)
|
||||||
# Bypass set_committed_value, which requires a real ORM instance (not MagicMock).
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"app.indexing_pipeline.indexing_pipeline_service.attach_chunks_to_document",
|
pipeline,
|
||||||
MagicMock(),
|
"_load_existing_chunks",
|
||||||
|
AsyncMock(return_value=[]),
|
||||||
|
)
|
||||||
|
|
||||||
|
async def _noop_persist(_session, doc, *_args, **_kwargs):
|
||||||
|
doc.status = DocumentStatus.ready()
|
||||||
|
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"app.indexing_pipeline.indexing_pipeline_service.persist_scratch_index",
|
||||||
|
_noop_persist,
|
||||||
)
|
)
|
||||||
|
|
||||||
connector_doc = make_connector_document(
|
connector_doc = make_connector_document(
|
||||||
|
|
@ -116,8 +124,17 @@ async def test_non_code_documents_use_hybrid_chunker(
|
||||||
MagicMock(side_effect=lambda texts: [[0.1] * _EMBEDDING_DIM for _ in texts]),
|
MagicMock(side_effect=lambda texts: [[0.1] * _EMBEDDING_DIM for _ in texts]),
|
||||||
)
|
)
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"app.indexing_pipeline.indexing_pipeline_service.attach_chunks_to_document",
|
pipeline,
|
||||||
MagicMock(),
|
"_load_existing_chunks",
|
||||||
|
AsyncMock(return_value=[]),
|
||||||
|
)
|
||||||
|
|
||||||
|
async def _noop_persist(_session, doc, *_args, **_kwargs):
|
||||||
|
doc.status = DocumentStatus.ready()
|
||||||
|
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"app.indexing_pipeline.indexing_pipeline_service.persist_scratch_index",
|
||||||
|
_noop_persist,
|
||||||
)
|
)
|
||||||
|
|
||||||
connector_doc = make_connector_document(
|
connector_doc = make_connector_document(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue