Skip to content

Commit 3b42dff

Browse files
committed
Merge remote-tracking branch 'origin/main' into reduce-logging
2 parents 37fa514 + 10cb6ed commit 3b42dff

File tree

4 files changed

+45
-67
lines changed

4 files changed

+45
-67
lines changed

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ include = [
9898
[tool.hatch.build.targets.wheel]
9999
packages = ["elasticsearch_serverless"]
100100

101-
[tool.pytest]
101+
[tool.pytest.ini_options]
102102
junit_family = "legacy"
103+
xfail_strict=true
103104

104105
[tool.isort]
105106
profile = "black"

test_elasticsearch_serverless/test_async/test_server/test_rest_api_spec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def async_runner(async_client_factory):
249249

250250
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
251251
async def test_rest_api_spec(test_spec, async_runner):
252-
if test_spec.get("skip", False):
253-
pytest.skip("Manually skipped in 'SKIP_TESTS'")
252+
if test_spec.get("fail", False):
253+
pytest.xfail("Manually marked as failing in 'FAILING_TESTS'")
254254
async_runner.use_spec(test_spec)
255255
await async_runner.run()

test_elasticsearch_serverless/test_server/test_helpers.py

+1
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ def test_reindex_index_datastream(op_type, sync_client):
920920
source_index="test_index_stream",
921921
target_index="py-test-stream",
922922
query={"query": {"bool": {"filter": {"term": {"type": "answers"}}}}},
923+
bulk_kwargs={"refresh": True},
923924
op_type=op_type,
924925
)
925926
assert sync_client.indices.exists(index="py-test-stream")

test_elasticsearch_serverless/test_server/test_rest_api_spec.py

+40-64
Original file line numberDiff line numberDiff line change
@@ -76,61 +76,37 @@
7676
}
7777

7878
# broken YAML tests on some releases
79-
SKIP_TESTS = {
80-
# Warning about date_histogram.interval deprecation is raised randomly
81-
"search/aggregation/250_moving_fn[1]",
82-
# body: null
83-
"indices/simulate_index_template/10_basic[2]",
84-
# No ML node with sufficient capacity / random ML failing
85-
"ml/start_stop_datafeed",
86-
"ml/post_data",
87-
"ml/jobs_crud",
88-
"ml/datafeeds_crud",
89-
"ml/set_upgrade_mode",
90-
"ml/reset_job[2]",
91-
"ml/jobs_get_stats",
92-
"ml/get_datafeed_stats",
93-
"ml/get_trained_model_stats",
94-
"ml/delete_job_force",
95-
"ml/jobs_get_result_overall_buckets",
96-
"ml/bucket_correlation_agg[0]",
97-
"ml/job_groups",
98-
"transform/transforms_stats_continuous[0]",
99-
# Fails bad request instead of 404?
100-
"ml/inference_crud",
101-
# rollup/security_tests time out?
102-
"rollup/security_tests",
103-
# Our TLS certs are custom
104-
"ssl/10_basic[0]",
105-
# Our user is custom
106-
"users/10_basic[3]",
107-
# License warning not sent?
108-
"license/30_enterprise_license[0]",
109-
# Shards/snapshots aren't right?
110-
"searchable_snapshots/10_usage[1]",
111-
# flaky data streams?
112-
"data_stream/10_basic[1]",
113-
"data_stream/80_resolve_index_data_streams[1]",
114-
# bad formatting?
115-
"cat/allocation/10_basic",
116-
"runtime_fields/10_keyword[8]",
117-
# service account number not right?
118-
"service_accounts/10_basic[1]",
119-
# doesn't use 'contains' properly?
120-
"xpack/10_basic[0]",
121-
"privileges/40_get_user_privs[0]",
122-
"privileges/40_get_user_privs[1]",
123-
"features/get_features/10_basic[0]",
124-
"features/reset_features/10_basic[0]",
125-
# bad use of 'is_false'?
126-
"indices/get_alias/10_basic[22]",
127-
# unique usage of 'set'
128-
"indices/stats/50_disk_usage[0]",
129-
"indices/stats/60_field_usage[0]",
130-
# actual Elasticsearch failure?
131-
"transform/transforms_stats",
132-
"transform/transforms_cat_apis",
133-
"transform/transforms_update",
79+
FAILING_TESTS = {
80+
# ping has a custom implementation in Python and returns a boolean
81+
"ping/ping",
82+
# TODO: bulk call in setup fails due to "malformed action/metadata line"
83+
# bulk body is being sent as a Buffer, unsure if related.
84+
"transform/10_basic",
85+
# TODO: wait_for_active_shards and rollover with conditions are not supported on serverless
86+
# see https://github.com/elastic/elasticsearch-clients-tests/issues/55
87+
"indices/rollover",
88+
# TODO: test runner needs to support ignoring 410 errors
89+
"indices/data_lifecycle",
90+
# TODO: test runner needs to support ignoring 410 errors
91+
"enrich/10_basic",
92+
# TODO: parameter `enabled` is not allowed in source
93+
# Same underlying problem as https://github.com/elastic/elasticsearch-clients-tests/issues/55
94+
"cluster/component_templates",
95+
# TODO: expecting `ct_field` field mapping to be returned, but instead only finds `field`
96+
"indices/simulate_template",
97+
# Fixed by https://github.com/elastic/elasticsearch-clients-tests/pull/56
98+
"cat/aliases",
99+
"cat/component_templates",
100+
"cat/count",
101+
"cat/help",
102+
"cat/indices",
103+
"cat/ml",
104+
"cat/transform",
105+
# TODO: Not investigated yet
106+
"indices/settings",
107+
"logstash/10_basic",
108+
"scroll/10_basic",
109+
"security/10_api_key_basic",
134110
}
135111

136112

@@ -578,11 +554,11 @@ def remove_implicit_resolver(cls, tag_to_remove):
578554
# Now we combine setup, teardown, and test_steps into
579555
# a set of pytest.param() instances
580556
for test_number, test_step in test_numbers_and_steps:
581-
# Build the id from the name of the YAML file and
582-
# the number within that file. Most important step
583-
# is to remove most of the file path prefixes and
584-
# the .yml suffix.
585-
pytest_test_name = yaml_file.rpartition(".")[0].replace(".", "/")
557+
# Build the id from the name of the YAML file and the number within
558+
# that file. Most important step is to remove most of the file path
559+
# prefixes and the .yml suffix.
560+
test_path = "/".join(yaml_file.split("/")[2:])
561+
pytest_test_name = test_path.rpartition(".")[0].replace(".", "/")
586562
for prefix in ("rest-api-spec/", "test/", "free/", "platinum/"):
587563
if pytest_test_name.startswith(prefix):
588564
pytest_test_name = pytest_test_name[len(prefix) :]
@@ -594,8 +570,8 @@ def remove_implicit_resolver(cls, tag_to_remove):
594570
"teardown": teardown_steps,
595571
}
596572
# Skip either 'test_name' or 'test_name[x]'
597-
if pytest_test_name in SKIP_TESTS or pytest_param_id in SKIP_TESTS:
598-
pytest_param["skip"] = True
573+
if pytest_test_name in FAILING_TESTS or pytest_param_id in FAILING_TESTS:
574+
pytest_param["fail"] = True
599575

600576
YAML_TEST_SPECS.append(pytest.param(pytest_param, id=pytest_param_id))
601577

@@ -615,7 +591,7 @@ def _pytest_param_sort_key(param: pytest.param) -> Tuple[Union[str, int], ...]:
615591

616592
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
617593
def test_rest_api_spec(test_spec, sync_runner):
618-
if test_spec.get("skip", False):
619-
pytest.skip("Manually skipped in 'SKIP_TESTS'")
594+
if test_spec.get("fail", False):
595+
pytest.xfail("Manually marked as failing in 'FAILING_TESTS'")
620596
sync_runner.use_spec(test_spec)
621597
sync_runner.run()

0 commit comments

Comments
 (0)