Unskip API tests, add xpack no_xpack default_shards features

This commit is contained in:
Seth Michael Larson
2020-02-28 11:36:03 -06:00
committed by GitHub
parent 2c7ea70201
commit 024abcfa39
3 changed files with 18 additions and 36 deletions
+14 -28
View File
@@ -24,31 +24,19 @@ PARAMS_RENAMES = {"type": "doc_type", "from": "from_"}
CATCH_CODES = {"missing": 404, "conflict": 409, "unauthorized": 401}
# test features we have implemented
IMPLEMENTED_FEATURES = ("gtelte", "stash_in_path", "headers", "catch_unauthorized")
IMPLEMENTED_FEATURES = {"gtelte", "stash_in_path", "headers", "catch_unauthorized", "default_shards"}
# broken YAML tests on some releases
SKIP_TESTS = {
"*": set(
(
# missing skip for transform_and_set feature
"TestApiKey10Basic",
# invalid license
"TestLicense20PutLicense",
"TestXpack15Basic",
# timeouts
"TestMlSetUpgradeMode",
# doesn't account for security index
"TestSnapshot10Basic",
# wrong exception, also body should be marked as required
"TestWatcherPutWatch10Basic",
# weird issue with SET cmd:
"TestUsers10Basic",
"TestWatcherExecuteWatch60HttpInput",
"TestSecurityHidden-Index13Security-TokensRead",
"TestSecurityHidden-Index14Security-Tokens-7Read",
"TestToken10Basic",
)
)
"*": {
# Can't figure out the get_alias(expand_wildcards=open) failure.
"TestIndicesGetAlias10Basic",
# Scripts are 7.6+
"TestScripts20GetScriptContext",
"TestScripts25GetScriptLanguages",
# Disallowing expensive queries is 7.7+
"TestSearch320DisallowQueries"
}
}
XPACK_FEATURES = None
@@ -61,11 +49,6 @@ class InvalidActionType(Exception):
class YamlTestCase(ElasticsearchTestCase):
def setUp(self):
super(YamlTestCase, self).setUp()
if self._feature_enabled("security"):
self.client.security.put_user(
username="x_pack_rest_user",
body={"password": "x-pack-test-password", "roles": ["superuser"]},
)
if hasattr(self, "_setup_code"):
self.run_code(self._setup_code)
self.last_response = None
@@ -106,13 +89,15 @@ class YamlTestCase(ElasticsearchTestCase):
super(YamlTestCase, self).tearDown()
def _feature_enabled(self, name):
global XPACK_FEATURES
global XPACK_FEATURES, IMPLEMENTED_FEATURES
if XPACK_FEATURES is None:
try:
xinfo = self.client.xpack.info()
XPACK_FEATURES = set(
f for f in xinfo["features"] if xinfo["features"][f]["enabled"]
)
IMPLEMENTED_FEATURES.add("xpack")
except RequestError as e:
# We receive a 'RequestError' here when using 'oss' because the request
# for xpack.info() looks like this: 'GET /_xpack' which errors on the
@@ -121,6 +106,7 @@ class YamlTestCase(ElasticsearchTestCase):
raise
XPACK_FEATURES = set()
IMPLEMENTED_FEATURES.add("no_xpack")
return name in XPACK_FEATURES