[7.x] Add test suite for async API

This commit is contained in:
Seth Michael Larson
2020-05-21 11:36:21 -05:00
committed by Seth Michael Larson
parent 05e5dc9402
commit a3e103b00e
6 changed files with 310 additions and 3 deletions
@@ -7,7 +7,9 @@ Dynamically generated set of TestCases based on set of yaml files describing
some integration tests. These files are shared among all official Elasticsearch
clients.
"""
import sys
import re
import os
from os import walk, environ
from os.path import exists, join, dirname, pardir, relpath
import yaml
@@ -44,6 +46,7 @@ SKIP_TESTS = {
# [interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future.
"search/aggregation/230_composite[6]",
"search/aggregation/250_moving_fn[1]",
"search/aggregation/250_moving_fn[2]",
# fails by not returning 'search'?
"search/320_disallow_queries[2]",
"search/40_indices_boost[1]",
@@ -58,11 +61,17 @@ SKIP_TESTS = {
"indices/put_template/10_basic[4]",
# depends on order of response JSON which is random
"indices/simulate_index_template/10_basic[1]",
# body: null? body is {}
"indices/simulate_index_template/10_basic[2]",
}
XPACK_FEATURES = None
ES_VERSION = None
RUN_ASYNC_REST_API_TESTS = (
sys.version_info >= (3, 6)
and os.environ.get("PYTHON_CONNECTION_CLASS") == "RequestsHttpConnection"
)
class YamlRunner:
@@ -78,7 +87,7 @@ class YamlRunner:
def use_spec(self, test_spec):
self._setup_code = test_spec.pop("setup", None)
self._run_code = test_spec.pop("run", None)
self._teardown_code = test_spec.pop("teardown")
self._teardown_code = test_spec.pop("teardown", None)
def setup(self):
if self._setup_code:
@@ -417,6 +426,8 @@ def sync_runner(sync_client):
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
def test_rest_api_spec(test_spec, sync_runner):
if RUN_ASYNC_REST_API_TESTS:
pytest.skip("Skipped running sync REST API tests")
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
sync_runner.use_spec(test_spec)