Private
Public Access
0
0

test(rag): update dim-mismatch test to assert rmtree behavior

The fix in 644d88ab changed the recovery path from client.delete_collection
to shutil.rmtree (chromadb 1.5.x delete_collection is broken on corrupted
state). The test still asserted the old behavior.
This commit is contained in:
2026-06-09 14:50:55 -04:00
parent 644d88ab93
commit 40f905d14b
+7 -1
View File
@@ -104,8 +104,14 @@ def test_rag_collection_dim_mismatch_recreates_collection(mock_get_chroma, mock_
mock_st.return_value = MagicMock()
engine = RAGEngine(config)
assert engine.collection == mock_collection
mock_client.delete_collection.assert_called_once_with("test")
# On dim mismatch, the fix wipes the chroma dir via shutil.rmtree
# (not via client.delete_collection which fails on corrupted state
# in chromadb 1.5.x with "RustBindingsAPI object has no attribute
# bindings"). The collection is then re-initialized by the inline
# re-init code, which calls get_or_create_collection once more
# (after the original _init_vector_store call).
assert mock_client.get_or_create_collection.call_count == 2
mock_client.delete_collection.assert_not_called()
@patch('src.rag_engine.LocalEmbeddingProvider.embed')
@patch('src.rag_engine._get_chromadb')