Reportportal internal error is causing the tests failure
manojguptavonage opened this issue · 2 comments
Describe the bug
Postgress DB storage is full and it is causing API failure. Due to this, API v2 is throwing a 405 error and returning a HTML response.
This is causing the tests to fail.
Although there is an internal mechanism to disable the report portal connection in the event of an API error, this scenario is not covered by that mechanism. The error logs below contain details of the API failures
`------------------------------------------------------------------------------- live log sessionstart -------------------------------------------------------------------------------
WARNING reportportal_client.core.rp_responses:rp_responses.py:79 Invalid response: Expecting value: line 1 column 1 (char 0): <!doctype html>
405 Not Allowed
nginx
Traceback (most recent call last):
File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/reportportal_client/core/rp_responses.py", line 77, in _get_json
return data.json()
File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
================================================================================ test session starts ================================================================================
platform darwin -- Python 3.10.2, pytest-7.2.1, pluggy-1.0.0
rootdir: /Users/XXXXXXXXXXXX/Documents/GitHub/reports/reports-smokes, configfile: pytest.ini
plugins: reportportal-5.1.5
collected 1 item
making request to RP:https://reportportal-XXXXX-dev-1-euw1.main0.api.XXXXX.dev.euw1.XXXXXnetworks.net/api/v2/api-telco-team_personal/item
None
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/_pytest/main.py", line 270, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in call
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR>
"/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/_pytest/main.py", line 349, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in call
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pluggy/_callers.py", line 34, in _multicall
INTERNALERROR> next(gen) # first yield
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pytest_reportportal/plugin.py", line 240, in pytest_runtest_protocol
INTERNALERROR> service.start_pytest_item(item)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pytest_reportportal/service.py", line 682, in start_pytest_item
INTERNALERROR> item_id = self._start_step(self._build_start_step_rq(current_leaf))
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/pytest_reportportal/service.py", line 654, in _start_step
INTERNALERROR> return self.rp.start_test_item(**step_rq)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/reportportal_client/client.py", line 399, in start_test_item
INTERNALERROR> verify_ssl=self.verify_ssl).make()
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/reportportal_client/core/rp_requests.py", line 76, in make
INTERNALERROR> return RPResponse(self.session_method(
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
INTERNALERROR> return self.request("POST", url, data=data, json=json, **kwargs)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/sessions.py", line 573, in request
INTERNALERROR> prep = self.prepare_request(req)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/sessions.py", line 484, in prepare_request
INTERNALERROR> p.prepare(
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/models.py", line 371, in prepare
INTERNALERROR> self.prepare_body(data, files, json)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/envs/reports-test-p3.10/lib/python3.10/site-packages/requests/models.py", line 511, in prepare_body
INTERNALERROR> body = complexjson.dumps(json, allow_nan=False)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/init.py", line 238, in dumps
INTERNALERROR> **kw).encode(obj)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/encoder.py", line 199, in encode
INTERNALERROR> chunks = self.iterencode(o, _one_shot=True)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/encoder.py", line 257, in iterencode
INTERNALERROR> return _iterencode(o, 0)
INTERNALERROR> File "/Users/XXXXXXXXXXXX/.pyenv/versions/3.10.2/lib/python3.10/json/encoder.py", line 179, in default
INTERNALERROR> raise TypeError(f'Object of type {o.class.name} '
INTERNALERROR> TypeError: Object of type _PresenceSentinel is not JSON serializable
------------------------------------------------------------------------------ live log sessionfinish -------------------------------------------------------------------------------
WARNING reportportal_client.client:client.py:135 Attempt to finish non-existent launch`
Could you please guide us exactly where we can handle this exception and break the report portal integration as soon as any such exception occurs ?
Ok, looks like it happens when there is no connectivity to reportportal.
The object looks like this (notice launchUuid
):
{
'attributes': [],
'codeRef': 'tests/test_foo.py:test_foo',
'description': 'Description: Foo',
'hasStats': True,
'launchUuid': <reportportal_client.static.defines._PresenceSentinel object at 0xffff6e6deb00>,
'name': 'tests/test_foo.py::test_foo[Bar-False]',
'retry': False,
'startTime': '1687764327924',
'testCaseId': 'tests/test_foo.py:test_foo[False,Bar]',
'type': 'STEP'
}