Skip to content

robot not generate log.html and report.html when exception raised by python lib #5278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
allenyllee opened this issue Nov 28, 2024 · 3 comments

Comments

@allenyllee
Copy link

During running test case, when test case failed with exception error raising by the python lib, the robot seems terminated by itself.

Here is the partial error message shown in console log:

[ ERROR ] Initializing library 'Redfish' with arguments [ https://10.1.50.248:443 | root | 0penBmc ] failed: RetriesExhaustedError
Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x708e8914be10>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='10.1.50.248', port=443): Max retries exceeded with url: /redfish/v1/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x708e8914be10>: Failed to establish a new connection: [Errno 113] No route to host'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 915, in _rest_request
    resp = self._session.request(method.upper(), "{}{}".format(self.__base_url, reqpath), data=body,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/requests/adapters.py", line 700, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='10.1.50.248', port=443): Max retries exceeded with url: /redfish/v1/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x708e8914be10>: Failed to establish a new connection: [Errno 113] No route to host'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/workspace/lib/bmc_redfish.py", line 50, in __init__
    super(bmc_redfish, self).__init__(*args, **kwargs)
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 1080, in __init__
    super(HttpClient, self).__init__(base_url, username=username,
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 505, in __init__
    self.get_root_object()
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 597, in get_root_object
    raise excp
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 595, in get_root_object
    resp = self.get(self.default_prefix)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/lib/redfish_plus.py", line 133, in get
    return self.rest_request(super(redfish_plus, self).get, *args,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/lib/redfish_plus.py", line 123, in rest_request
    response = func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 633, in get
    return self._rest_request(path, method='GET', args=args,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 1118, in _rest_request
    return super(HttpClient, self)._rest_request(path=path, method=method,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/redfish/rest/v1.py", line 959, in _rest_request
    raise RetriesExhaustedError() from cause_exception
redfish.rest.v1.RetriesExhaustedError

Try --help for usage information.

This error indicate that the redfish python lib encounter some network issue, it retries many times and raise exception.

I also try to regenerate report.html by execute rebot output.xml, but it says:

[ ERROR ] Reading XML source 'output.xml' failed: Incompatible child element 'errors' for 'suite'.

Try --help for usage information.

Here is the output.xml:
output (複製).zip

@pekkaklarck
Copy link
Member

For some reason the whole execution crashes when initializing the library as part of the importing process fails. This shouldn't happen, we have tests for handling errors like this so that execution can continue normally. I also tested this separately with a simple library that has a failing __init__. I even tried raising redfish.rest.v1.RetriesExhaustedError to see is that exception somehow special, but also that was handled fine.

Can you provide a simple example I could use to reproduce this? Also, what Robot Framework version did you use?

@pekkaklarck
Copy link
Member

Any new info related to this? I cannot reproduce the problem so if there's no updates I cannot do anything else than close this issue.

@pekkaklarck
Copy link
Member

No updates, closing.

@pekkaklarck pekkaklarck closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants