self = <swh.search.tests.test_elasticsearch.TestElasticsearchSearch testMethod=test_origin_intrinsic_metadata_update>
def test_origin_intrinsic_metadata_update(self):
origin = {"url": "http://origin1"}
origin_data = {
**origin,
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"author": "John Doe",
},
}
> self.search.origin_update([origin_data])
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_search.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.search.elasticsearch.ElasticSearch object at 0x7f4d5014e5f8>
args = ([{'intrinsic_metadata': {'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', 'author': 'John Doe'}, 'url': 'http://origin1'}],)
kwargs = {}, script_error = True
error_detail = '\nPainless update script failed (compile error).\nerror type: illegal_argument_exception\nerror reason: invalid decla...nscript stack:\n\n... it_types field value\nLit visit_types = ctx._source ...\n ^---- HERE'
error = {'caused_by': {'reason': 'invalid declaration: cannot resolve type [Lit]', 'type': 'illegal_argument_exception'}, 'lang': 'painless', 'position': {'end': 72, 'offset': 47, 'start': 22}, 'reason': 'compile error', ...}
@py_assert2 = False, @py_assert1 = False, @py_format4 = 'True is False'
@py_format6 = 'Painless update script failed (compile error).\n~error type: illegal_argument_exception\n~error reason: invalid decla...types field value\n~Lit visit_types = ctx._source ...\n~ ^---- HERE\n>assert True is False'
def _origin_update(self, *args, **kwargs):
script_error = False
error_detail = ""
try:
origin_update(*args, **kwargs)
except BulkIndexError as e:
error = e.errors[0].get("update", {}).get("error", {}).get("caused_by")
if error and "script_stack" in error:
script_error = True
error_detail = dedent(
f"""
Painless update script failed ({error.get('reason')}).
error type: {error.get('caused_by', {}).get('type')}
error reason: {error.get('caused_by', {}).get('reason')}
script stack:
"""
)
error_detail += "\n".join(error["script_stack"])
else:
raise e
> assert script_error is False, error_detail[1:]
E AssertionError: Painless update script failed (compile error).
E error type: illegal_argument_exception
E error reason: invalid declaration: cannot resolve type [Lit]
E script stack:
E
E ... it_types field value
E Lit visit_types = ctx._source ...
E ^---- HERE
E assert True is False
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_elasticsearch.py:50: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jun 11 2021, 12:30 PM