refactor(qdrant): use async DocumentStore mixin tests#3093
refactor(qdrant): use async DocumentStore mixin tests#3093SyedShahmeerAli12 wants to merge 3 commits intodeepset-ai:mainfrom
Conversation
anakin87
left a comment
There was a problem hiding this comment.
👋
Could you please fix the conflict?
09aa131 to
1028adb
Compare
| from haystack.document_stores.errors import DuplicateDocumentError | ||
| from haystack.document_stores.types import DuplicatePolicy | ||
| from haystack.testing.document_store import ( | ||
| CountDocumentsByFilterAsyncTest, |
There was a problem hiding this comment.
We need to move those for the import below - they are already in haystack.testing.document_store_async in main. We need to wait for the next release then to merge this.
There was a problem hiding this comment.
That also explains the 6 CI failures on
test_count_unique_metadata_by_filter_async_all_documents the current mixin in
haystack.testing.document_store uses sync write_documents, which initializes a separate
in-memory client from the async one used by count_unique_metadata_by_filter_async. So the
async client sees an empty store and returns 0.
I'll update the imports to haystack.testing.document_store_async once the next haystack
release ships those changes.
Closes deepset-ai#3052 Replaces duplicate async test implementations with the mixin classes from haystack.testing.document_store and haystack.testing.document_store_async. - Removes 19 tests now covered by the mixins - Keeps all Qdrant-specific tests (hybrid search, sparse config, collection setup validation, vector preservation)
…clients When using location=':memory:', QdrantClient and AsyncQdrantClient each create a separate in-memory store, so data written via the sync client is invisible to the async client and vice versa. Fix by sharing the underlying .collections and .aliases dicts after the second client is initialised, so both clients always see the same data. This makes mixed sync/async tests (e.g. sync write_documents + async count_unique_metadata_by_filter_async) work correctly with in-memory stores.
- Override assert_documents_are_equal to compare by ID set (Qdrant returns embedding vectors on all docs and doesn't guarantee order) - Override test_write_documents_async (base raises NotImplementedError by design, requires store-specific implementation) - Override test_count_not_empty_async to add missing self parameter (bug in haystack mixin causes fixture injection to fail)
faa8e99 to
6ac1294
Compare
Related Issues
▎ Closes #3052
▎ What this changes
▎ Refactors integrations/qdrant/tests/test_document_store_async.py to inherit from the async
mixin classes introduced in deepset-ai/haystack#10799.
▎ - Removes 19 duplicate tests now covered by the mixins
▎ - Keeps all Qdrant-specific tests (hybrid search, sparse config, collection setup
validation, vector preservation)
▎ - Adds FilterDocumentsAsyncTest and CountDocumentsAsyncTest since Qdrant implements both
filter_documents_async and count_documents_async