Skip to content

Commit 6539c59

Browse files
committed
Fix test_errors_are_reported_correctly
1 parent 231a511 commit 6539c59

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

test_elasticsearch/test_async/test_server/test_helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,11 @@ async def test_errors_are_reported_correctly(self, async_client):
351351
assert "42" == error["index"]["_id"]
352352
assert "i" == error["index"]["_index"]
353353
print(error["index"]["error"])
354-
assert "MapperParsingException" in repr(
355-
error["index"]["error"]
356-
) or "mapper_parsing_exception" in repr(error["index"]["error"])
354+
assert error["index"]["error"]["type"] in [
355+
"mapper_parsing_exception",
356+
# Elasticsearch 8.8+: https://github.com/elastic/elasticsearch/pull/92646
357+
"document_parsing_exception",
358+
]
357359

358360
async def test_error_is_raised(self, async_client):
359361
await async_client.indices.create(

test_elasticsearch/test_server/test_helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,11 @@ def test_errors_are_reported_correctly(sync_client):
339339
assert "42" == error["index"]["_id"]
340340
assert "i" == error["index"]["_index"]
341341
print(error["index"]["error"])
342-
assert "MapperParsingException" in repr(
343-
error["index"]["error"]
344-
) or "mapper_parsing_exception" in repr(error["index"]["error"])
342+
assert error["index"]["error"]["type"] in [
343+
"mapper_parsing_exception",
344+
# Elasticsearch 8.8+: https://github.com/elastic/elasticsearch/pull/92646
345+
"document_parsing_exception",
346+
]
345347

346348

347349
def test_error_is_raised(sync_client):

0 commit comments

Comments
 (0)