Skip to content

Fix CI #84

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 4 commits into from
Oct 10, 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
3 changes: 3 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
spec:
repository: elastic/elasticsearch-serverless-python
pipeline_file: .buildkite/rest-tests.yaml
env:
SLACK_NOTIFICATIONS_CHANNEL: '#devtools-notify-python'
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
teams:
devtools-team:
access_level: MANAGE_BUILD_AND_READ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# under the License.

import asyncio
import sys
from datetime import datetime, timedelta, timezone
from unittest.mock import MagicMock, call, patch

Expand All @@ -31,11 +30,6 @@
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)
Expand Down Expand Up @@ -82,7 +76,6 @@ 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(
Expand All @@ -95,7 +88,6 @@ 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):
Expand Down Expand Up @@ -314,7 +306,6 @@ 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(
Expand All @@ -328,7 +319,6 @@ 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(
Expand Down Expand Up @@ -369,6 +359,10 @@ async def test_error_is_raised(self, async_client):
await helpers.async_bulk(async_client, [{"a": 42}, {"a": "c"}], index="i")

async def test_ignore_error_if_raised(self, async_client):
await async_client.indices.create(
index="i", mappings={"properties": {"a": {"type": "long"}}}
)

# ignore the status code 400 in tuple
await helpers.async_bulk(
async_client, [{"a": 42}, {"a": "c"}], index="i", ignore_status=(400,)
Expand Down Expand Up @@ -464,7 +458,6 @@ 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):
Expand All @@ -486,7 +479,6 @@ 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):
Expand Down Expand Up @@ -898,7 +890,6 @@ 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
):
Expand All @@ -920,7 +911,6 @@ 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,
Expand All @@ -940,7 +930,6 @@ 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}
Expand Down Expand Up @@ -991,7 +980,6 @@ 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
):
Expand All @@ -1011,7 +999,6 @@ 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
):
Expand Down
4 changes: 4 additions & 0 deletions test_elasticsearch_serverless/test_server/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ def test_error_is_raised(sync_client):


def test_ignore_error_if_raised(sync_client):
sync_client.indices.create(
index="i", mappings={"properties": {"a": {"type": "long"}}}
)

# ignore the status code 400 in tuple
helpers.bulk(sync_client, [{"a": 42}, {"a": "c"}], index="i", ignore_status=(400,))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"logstash/10_basic",
"scroll/10_basic",
"security/10_api_key_basic",
"machine_learning/jobs_crud[0]",
}
SKIPPED_TESTS = {
# Timeouts with async client
Expand Down
8 changes: 8 additions & 0 deletions test_elasticsearch_serverless/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ def is_xpack_template(name):
"traces-apm@mappings",
"traces-apm.rum@mappings",
"traces@mappings",
"traces@settings",
# otel
"metrics-otel@mappings",
"semconv-resource-to-ecs@mappings",
"traces-otel@mappings",
"ecs-tsdb@mappings",
"logs-otel@mappings",
"otel@mappings",
}:
return True
return False
Expand Down
Loading