Skip to content

Commit 4cdf81e

Browse files
authored
Added new test case for bulk delete with single item (#878)
Signed-off-by: Harshil Jani <[email protected]>
1 parent 4091816 commit 4cdf81e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test_opensearchpy/test_server/test_clients.py

+12
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ def test_bulk_works_with_bytestring_body(self) -> None:
110110
self.assertFalse(response["errors"])
111111
self.assertEqual(1, len(response["items"]))
112112

113+
def test_bulk_works_with_delete(self) -> None:
114+
docs = '{ "index" : { "_index" : "bulk_test_index", "_id" : "1" } }\n{"answer": 42}\n{ "delete" : { "_index" : "bulk_test_index", "_id": "1" } }'
115+
response = self.client.bulk(body=docs)
116+
117+
self.assertFalse(response["errors"])
118+
self.assertEqual(2, len(response["items"]))
119+
120+
# Check insertion status
121+
self.assertEqual(201, response["items"][0]["index"]["status"])
122+
# Check deletion status
123+
self.assertEqual(200, response["items"][1]["delete"]["status"])
124+
113125

114126
class TestClose(OpenSearchTestCase):
115127
def test_close_doesnt_break_client(self) -> None:

0 commit comments

Comments
 (0)