diff --git a/test_elasticsearch_serverless/test_async/test_server/test_helpers.py b/test_elasticsearch_serverless/test_async/test_server/test_helpers.py index 601fe35..68d81e6 100644 --- a/test_elasticsearch_serverless/test_async/test_server/test_helpers.py +++ b/test_elasticsearch_serverless/test_async/test_server/test_helpers.py @@ -16,6 +16,7 @@ # under the License. import asyncio +import sys from datetime import datetime, timedelta, timezone from unittest.mock import MagicMock, call, patch @@ -30,6 +31,11 @@ pytestmark = [pytest.mark.asyncio] +async_bulk_xfail = pytest.mark.xfail( + sys.version_info < (3, 11), reason="Investigated in issue #62" +) + + class AsyncMock(MagicMock): async def __call__(self, *args, **kwargs): return super(AsyncMock, self).__call__(*args, **kwargs) @@ -76,6 +82,7 @@ async def test_actions_remain_unchanged(self, async_client): assert ok assert [{"_id": 1}, {"_id": 2}] == actions + @async_bulk_xfail async def test_all_documents_get_inserted(self, async_client): docs = [{"answer": x, "_id": x} for x in range(100)] async for ok, item in helpers.async_streaming_bulk( @@ -88,6 +95,7 @@ async def test_all_documents_get_inserted(self, async_client): "_source" ] + @async_bulk_xfail async def test_documents_data_types(self, async_client): async def async_gen(): for x in range(100): @@ -306,6 +314,7 @@ async def test_bulk_works_with_single_item(self, async_client): "_source" ] + @async_bulk_xfail async def test_all_documents_get_inserted(self, async_client): docs = [{"answer": x, "_id": x} for x in range(100)] success, failed = await helpers.async_bulk( @@ -319,6 +328,7 @@ async def test_all_documents_get_inserted(self, async_client): "_source" ] + @async_bulk_xfail async def test_stats_only_reports_numbers(self, async_client): docs = [{"answer": x} for x in range(100)] success, failed = await helpers.async_bulk( @@ -454,6 +464,7 @@ async def scan_teardown(async_client): class TestScan(object): + @async_bulk_xfail async def test_order_can_be_preserved(self, async_client, scan_teardown): bulk = [] for x in range(100): @@ -475,6 +486,7 @@ async def test_order_can_be_preserved(self, async_client, scan_teardown): assert list(map(str, range(100))) == list(d["_id"] for d in docs) assert list(range(100)) == list(d["_source"]["answer"] for d in docs) + @async_bulk_xfail async def test_all_documents_are_read(self, async_client, scan_teardown): bulk = [] for x in range(100): @@ -886,6 +898,7 @@ async def reindex_setup(async_client): class TestReindex(object): + @async_bulk_xfail async def test_reindex_passes_kwargs_to_scan_and_bulk( self, async_client, reindex_setup ): @@ -907,6 +920,7 @@ async def test_reindex_passes_kwargs_to_scan_and_bulk( await async_client.get(index="prod_index", id=42) )["_source"] + @async_bulk_xfail async def test_reindex_accepts_a_query(self, async_client, reindex_setup): await helpers.async_reindex( async_client, @@ -926,6 +940,7 @@ async def test_reindex_accepts_a_query(self, async_client, reindex_setup): await async_client.get(index="prod_index", id=42) )["_source"] + @async_bulk_xfail async def test_all_documents_get_moved(self, async_client, reindex_setup): await helpers.async_reindex( async_client, "test_index", "prod_index", bulk_kwargs={"refresh": True} @@ -976,6 +991,7 @@ async def reindex_data_stream_setup(async_client): class TestAsyncDataStreamReindex(object): @pytest.mark.parametrize("op_type", [None, "create"]) + @async_bulk_xfail async def test_reindex_index_datastream( self, op_type, async_client, reindex_data_stream_setup ): @@ -995,6 +1011,7 @@ async def test_reindex_index_datastream( ] ) + @async_bulk_xfail async def test_reindex_index_datastream_op_type_index( self, async_client, reindex_data_stream_setup ): diff --git a/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py b/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py index f0b5db1..d058ba4 100644 --- a/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py +++ b/test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py @@ -251,5 +251,7 @@ def async_runner(async_client_factory): async def test_rest_api_spec(test_spec, async_runner): if test_spec.get("fail", False): pytest.xfail("Manually marked as failing in 'FAILING_TESTS'") + elif test_spec.get("skip", False): + pytest.xfail("Manually skipped") async_runner.use_spec(test_spec) await async_runner.run() diff --git a/test_elasticsearch_serverless/test_server/test_rest_api_spec.py b/test_elasticsearch_serverless/test_server/test_rest_api_spec.py index 4e7446a..bb750d4 100644 --- a/test_elasticsearch_serverless/test_server/test_rest_api_spec.py +++ b/test_elasticsearch_serverless/test_server/test_rest_api_spec.py @@ -572,6 +572,9 @@ def remove_implicit_resolver(cls, tag_to_remove): # Skip either 'test_name' or 'test_name[x]' if pytest_test_name in FAILING_TESTS or pytest_param_id in FAILING_TESTS: pytest_param["fail"] = True + # https://github.com/elastic/elasticsearch-serverless-python/issues/63 + elif pytest_param_id == "cluster/cluster_info[0]": + pytest_param["skip"] = True YAML_TEST_SPECS.append(pytest.param(pytest_param, id=pytest_param_id)) @@ -593,5 +596,7 @@ def _pytest_param_sort_key(param: pytest.param) -> Tuple[Union[str, int], ...]: def test_rest_api_spec(test_spec, sync_runner): if test_spec.get("fail", False): pytest.xfail("Manually marked as failing in 'FAILING_TESTS'") + elif test_spec.get("skip", False): + pytest.skip("Manually marked as skipped") sync_runner.use_spec(test_spec) sync_runner.run()