[7.x] Add support for 'allowed_warnings' feature
This commit is contained in:
committed by
Seth Michael Larson
parent
eaff4af910
commit
521d4db641
@@ -34,6 +34,7 @@ IMPLEMENTED_FEATURES = {
|
|||||||
"catch_unauthorized",
|
"catch_unauthorized",
|
||||||
"default_shards",
|
"default_shards",
|
||||||
"warnings",
|
"warnings",
|
||||||
|
"allowed_warnings",
|
||||||
}
|
}
|
||||||
|
|
||||||
# broken YAML tests on some releases
|
# broken YAML tests on some releases
|
||||||
@@ -150,6 +151,7 @@ class YamlRunner:
|
|||||||
headers = action.pop("headers", None)
|
headers = action.pop("headers", None)
|
||||||
catch = action.pop("catch", None)
|
catch = action.pop("catch", None)
|
||||||
warn = action.pop("warnings", ())
|
warn = action.pop("warnings", ())
|
||||||
|
allowed_warnings = action.pop("allowed_warnings", ())
|
||||||
assert len(action) == 1
|
assert len(action) == 1
|
||||||
|
|
||||||
method, args = list(action.items())[0]
|
method, args = list(action.items())[0]
|
||||||
@@ -189,11 +191,12 @@ class YamlRunner:
|
|||||||
str(w.message)
|
str(w.message)
|
||||||
for w in caught_warnings
|
for w in caught_warnings
|
||||||
if w.category == ElasticsearchDeprecationWarning
|
if w.category == ElasticsearchDeprecationWarning
|
||||||
|
and str(w.message) not in allowed_warnings
|
||||||
]
|
]
|
||||||
|
|
||||||
# Sorting removes the issue with order raised. We only care about
|
# Sorting removes the issue with order raised. We only care about
|
||||||
# if all warnings are raised in the single API call.
|
# if all warnings are raised in the single API call.
|
||||||
if warn is not None and sorted(warn) != sorted(caught_warnings):
|
if warn and sorted(warn) != sorted(caught_warnings):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"Expected warnings not equal to actual warnings: expected=%r actual=%r"
|
"Expected warnings not equal to actual warnings: expected=%r actual=%r"
|
||||||
% (warn, caught_warnings)
|
% (warn, caught_warnings)
|
||||||
|
|||||||
Reference in New Issue
Block a user