Skip to content

Fix test_bulk_works_with_bytestring_body #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,21 @@ async def test_bulk_works_with_bytestring_body(async_client):
docs = (
b'{ "index" : { "_index" : "bulk_test_index", "_id" : "2" } }\n{"answer": 42}'
)
response = await async_client.bulk(body=docs)
resp = await async_client.bulk(body=docs)

assert response["errors"] is False
assert len(response["items"]) == 1
assert resp["errors"] is False
assert len(resp["items"]) == 1

# Pop inconsistent items before asserting
resp["items"][0]["index"].pop("_id")
resp["items"][0]["index"].pop("_version")
resp["items"][0]["index"].pop("_shards")
assert resp["items"][0] == {
"index": {
"_index": "bulk_test_index",
"result": "created",
"_seq_no": 0,
"_primary_term": 1,
"status": 201,
}
}
2 changes: 1 addition & 1 deletion test_elasticsearch_serverless/test_server/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def test_bulk_works_with_bytestring_body(sync_client):
# Pop inconsistent items before asserting
resp["items"][0]["index"].pop("_id")
resp["items"][0]["index"].pop("_version")
resp["items"][0]["index"].pop("_shards")
assert resp["items"][0] == {
"index": {
"_index": "bulk_test_index",
"result": "created",
"_shards": {"total": 2, "successful": 1, "failed": 0},
"_seq_no": 0,
"_primary_term": 1,
"status": 201,
Expand Down
Loading