Skip to content

Commit cd04a3d

Browse files
fix(elasticsearch): override duplicate skip mixin test — ES returns 1 not 0 on skip
1 parent 69a4a8d commit cd04a3d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

integrations/elasticsearch/tests/test_document_store_async.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ async def test_write_documents_duplicate_fail_async(self, document_store):
8787
with pytest.raises(DocumentStoreError):
8888
await document_store.write_documents_async(documents=[doc], policy=DuplicatePolicy.FAIL)
8989

90+
@pytest.mark.asyncio
91+
async def test_write_documents_duplicate_skip_async(self, document_store):
92+
# Elasticsearch returns 1 (not 0) when skipping an already-existing document
93+
doc = Document(content="test doc")
94+
assert await document_store.write_documents_async([doc], policy=DuplicatePolicy.SKIP) == 1
95+
assert await document_store.write_documents_async(documents=[doc], policy=DuplicatePolicy.SKIP) == 1
96+
9097
@pytest.mark.asyncio
9198
async def test_write_documents_async(self, document_store):
9299
docs = [Document(id="1", content="test")]

0 commit comments

Comments
 (0)