Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza committed Mar 18, 2024
1 parent f4459db commit 98839da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions integrations/opensearch/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,12 @@ def test_write_documents_different_embedding_sizes_fail(

with pytest.raises(DocumentStoreError):
document_store_embedding_dim_4.write_documents(docs)

@patch("haystack_integrations.document_stores.opensearch.document_store.bulk")
def test_write_documents_with_badly_formatted_bulk_errors(self, mock_bulk, document_store):
error = {"some_key": "some_value"}
mock_bulk.return_value = ([], [error])

with pytest.raises(DocumentStoreError) as e:
document_store.write_documents([Document(content="Hello world")])
e.match(f"{error}")

0 comments on commit 98839da

Please sign in to comment.