16
16
# under the License.
17
17
18
18
import asyncio
19
- import sys
20
19
from datetime import datetime , timedelta , timezone
21
20
from unittest .mock import MagicMock , call , patch
22
21
31
30
pytestmark = [pytest .mark .asyncio ]
32
31
33
32
34
- async_bulk_xfail = pytest .mark .xfail (
35
- sys .version_info < (3 , 11 ), reason = "Investigated in issue #62"
36
- )
37
-
38
-
39
33
class AsyncMock (MagicMock ):
40
34
async def __call__ (self , * args , ** kwargs ):
41
35
return super (AsyncMock , self ).__call__ (* args , ** kwargs )
@@ -82,7 +76,6 @@ async def test_actions_remain_unchanged(self, async_client):
82
76
assert ok
83
77
assert [{"_id" : 1 }, {"_id" : 2 }] == actions
84
78
85
- @async_bulk_xfail
86
79
async def test_all_documents_get_inserted (self , async_client ):
87
80
docs = [{"answer" : x , "_id" : x } for x in range (100 )]
88
81
async for ok , item in helpers .async_streaming_bulk (
@@ -95,7 +88,6 @@ async def test_all_documents_get_inserted(self, async_client):
95
88
"_source"
96
89
]
97
90
98
- @async_bulk_xfail
99
91
async def test_documents_data_types (self , async_client ):
100
92
async def async_gen ():
101
93
for x in range (100 ):
@@ -314,7 +306,6 @@ async def test_bulk_works_with_single_item(self, async_client):
314
306
"_source"
315
307
]
316
308
317
- @async_bulk_xfail
318
309
async def test_all_documents_get_inserted (self , async_client ):
319
310
docs = [{"answer" : x , "_id" : x } for x in range (100 )]
320
311
success , failed = await helpers .async_bulk (
@@ -328,7 +319,6 @@ async def test_all_documents_get_inserted(self, async_client):
328
319
"_source"
329
320
]
330
321
331
- @async_bulk_xfail
332
322
async def test_stats_only_reports_numbers (self , async_client ):
333
323
docs = [{"answer" : x } for x in range (100 )]
334
324
success , failed = await helpers .async_bulk (
@@ -369,6 +359,10 @@ async def test_error_is_raised(self, async_client):
369
359
await helpers .async_bulk (async_client , [{"a" : 42 }, {"a" : "c" }], index = "i" )
370
360
371
361
async def test_ignore_error_if_raised (self , async_client ):
362
+ await async_client .indices .create (
363
+ index = "i" , mappings = {"properties" : {"a" : {"type" : "long" }}}
364
+ )
365
+
372
366
# ignore the status code 400 in tuple
373
367
await helpers .async_bulk (
374
368
async_client , [{"a" : 42 }, {"a" : "c" }], index = "i" , ignore_status = (400 ,)
@@ -464,7 +458,6 @@ async def scan_teardown(async_client):
464
458
465
459
466
460
class TestScan (object ):
467
- @async_bulk_xfail
468
461
async def test_order_can_be_preserved (self , async_client , scan_teardown ):
469
462
bulk = []
470
463
for x in range (100 ):
@@ -486,7 +479,6 @@ async def test_order_can_be_preserved(self, async_client, scan_teardown):
486
479
assert list (map (str , range (100 ))) == list (d ["_id" ] for d in docs )
487
480
assert list (range (100 )) == list (d ["_source" ]["answer" ] for d in docs )
488
481
489
- @async_bulk_xfail
490
482
async def test_all_documents_are_read (self , async_client , scan_teardown ):
491
483
bulk = []
492
484
for x in range (100 ):
@@ -898,7 +890,6 @@ async def reindex_setup(async_client):
898
890
899
891
900
892
class TestReindex (object ):
901
- @async_bulk_xfail
902
893
async def test_reindex_passes_kwargs_to_scan_and_bulk (
903
894
self , async_client , reindex_setup
904
895
):
@@ -920,7 +911,6 @@ async def test_reindex_passes_kwargs_to_scan_and_bulk(
920
911
await async_client .get (index = "prod_index" , id = 42 )
921
912
)["_source" ]
922
913
923
- @async_bulk_xfail
924
914
async def test_reindex_accepts_a_query (self , async_client , reindex_setup ):
925
915
await helpers .async_reindex (
926
916
async_client ,
@@ -940,7 +930,6 @@ async def test_reindex_accepts_a_query(self, async_client, reindex_setup):
940
930
await async_client .get (index = "prod_index" , id = 42 )
941
931
)["_source" ]
942
932
943
- @async_bulk_xfail
944
933
async def test_all_documents_get_moved (self , async_client , reindex_setup ):
945
934
await helpers .async_reindex (
946
935
async_client , "test_index" , "prod_index" , bulk_kwargs = {"refresh" : True }
@@ -991,7 +980,6 @@ async def reindex_data_stream_setup(async_client):
991
980
992
981
class TestAsyncDataStreamReindex (object ):
993
982
@pytest .mark .parametrize ("op_type" , [None , "create" ])
994
- @async_bulk_xfail
995
983
async def test_reindex_index_datastream (
996
984
self , op_type , async_client , reindex_data_stream_setup
997
985
):
@@ -1011,7 +999,6 @@ async def test_reindex_index_datastream(
1011
999
]
1012
1000
)
1013
1001
1014
- @async_bulk_xfail
1015
1002
async def test_reindex_index_datastream_op_type_index (
1016
1003
self , async_client , reindex_data_stream_setup
1017
1004
):
0 commit comments