ros2 / sros2

tools to generate and distribute keys for SROS 2
Apache License 2.0
89 stars 44 forks source link

test_generate_policy fails on macOS #226

Closed jacobperron closed 4 years ago

jacobperron commented 4 years ago

Bug report

Required Info:

Steps to reproduce issue

Running the tests on macOS sometimes results in a failure. Example failure.

Expected behavior

All tests pass.

Actual behavior

test_generate_policy fails with:

FAIL: TestSROS2GeneratePolicyVerb.test_generate_policy_topics[rmw_fastrtps_dynamic_cpp, False]
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/osrf/jenkins-agent/workspace/nightly_osx_extra_rmw_release/ws/src/ros2/sros2/sros2/test/sros2/commands/security/verbs/test_generate_policy.py", line 108, in test_generate_policy_topics
    assert self.wait_for(expected_topics=[
  File "/Users/osrf/jenkins-agent/workspace/nightly_osx_extra_rmw_release/ws/src/ros2/sros2/sros2/test/sros2/commands/security/verbs/utilities/sros2_cli_test_case.py", line 101, in wait_for
    with NodeStrategy(args) as node:
  File "/Users/osrf/jenkins-agent/workspace/nightly_osx_extra_rmw_release/ws/install/ros2cli/lib/python3.8/site-packages/ros2cli/node/strategy.py", line 52, in __enter__
    self._daemon_node.__enter__()
  File "/Users/osrf/jenkins-agent/workspace/nightly_osx_extra_rmw_release/ws/install/ros2cli/lib/python3.8/site-packages/ros2cli/node/daemon.py", line 116, in __enter__
    methods = self._proxy.system.listMethods()
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1109, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1450, in __request
    response = self.__transport.request(
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1153, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1165, in single_request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1278, in send_request
    self.send_content(connection, request_body)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1308, in send_content
    connection.endheaders(request_body)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1004, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 944, in send
    self.connect()
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 915, in connect
    self.sock = self._create_connection(
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 808, in create_connection
    raise err
  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 60] Operation timed out

Additional information

The failure is flaky and seems independent of the RMW implementation as failures have been seen with different RMWs (example).

jacobperron commented 4 years ago

In all failures that I see, it appears that use_daemon is always False.

It looks like this code path is not what is expected, since in the test we pass the argument use_daemon to the CLI node:

https://github.com/ros2/sros2/blob/dbec91d1c9efafadb9b7eeb183cc5f2663feb136/sros2/test/sros2/commands/security/verbs/utilities/sros2_cli_test_case.py#L99

but, the CLI node is looking for an argument named no_daemon:

https://github.com/ros2/ros2cli/blob/95bfb056df795b6eef8bb73b165db31fcf2d867a/ros2cli/ros2cli/node/strategy.py#L26

mikaelarguedas commented 4 years ago

Thanks for the report and investigation :+1: