Skip to content
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

Added tests for ros2action and ros2msg #287

Merged
merged 13 commits into from
Jul 9, 2019

Conversation

ivanpauno
Copy link
Member

The idea of this is start increasing testing coverage in all the ros2cli related command line tools, to avoid manual testing in the next release.

Continuation of ros2/system_tests#372.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno ivanpauno added enhancement New feature or request in review Waiting for review (Kanban column) labels Jun 24, 2019
@ivanpauno ivanpauno self-assigned this Jun 24, 2019
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple comments, but overall it looks like it's going in the right direction.

Though I recall that @cevans87 was recently working on something over these lines. Not sure exactly, but you may join efforts, or at least not duplicate.

<name>test_ros2cli</name>
<version>0.7.4</version>
<description>
Test of the ROS2 command line tools Framework.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivanpauno consider:

Suggested change
Test of the ROS2 command line tools Framework.
Tests for ROS2 command line tools.

@@ -0,0 +1,107 @@
# Copyright 2019 Open Source Robotics Foundation, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivanpauno both here and in the next config_*.py file, I wonder if we can aggregate the information that's currently distributed in multiple collections into a single one so that's easier to read and extend. For instance, a list of dictionaries that keep verb, flags, output, etc. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Config class could also use the __slots__ attribute and/or a __init__ method for setting the members that the test code expects. These could then be documented to make it easier for future readers adding tests.

@cevans87
Copy link

Though I recall that @cevans87 was recently working on something over these lines. Not sure exactly, but you may join efforts, or at least not duplicate.

I think you're right. This looks similar to what I prototyped last week.

The only major difference I see is that I tested cli functionality by using python subprocess.

If this automates the manual release testing and it's easy to test with any rmw implementation, I'm on board. It looks like we can translate the tests I've written to live in this repo and look like these tests.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

If this automates the manual release testing and it's easy to test with any rmw implementation, I'm on board.

Yes, probably using ros_testing is better, as it should be the standard way to write this kind of tests.

It looks like we can translate the tests I've written to live in this repo and look like these tests.

Sounds good.
I think they should live with the code it's testing, in this case in https://github.com/ros2/demos itself.
I originally opened this in ros2/system_tests#372, and then I moved them here for the same reason.

Also, the cli will probably look different soon: #288.
I think ros2msg, ros2srv will be deleted. Also list and show verbs of ros2action.

So I will wait a little bit, until that PR gets merged.

Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree @hidmic that it would be easier to understand and extend the tests if the config structure was changed.

It would be nice if we defined something like a 'TestCase' object that contained the command, verb with options, other launch actions, and the expected output. This could then be passed as a single list as the test configuration.

E.g.

class TestCase:
    command = 'msg'
    verb = 'show std_msgs/msg/String'
    launch_actions = []
    expected_output = ['string data']

Edit: maybe command and verb could be combined?

test_ros2cli/CMakeLists.txt Outdated Show resolved Hide resolved
test_ros2cli/CMakeLists.txt Outdated Show resolved Hide resolved
@@ -0,0 +1,107 @@
# Copyright 2019 Open Source Robotics Foundation, Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Config class could also use the __slots__ attribute and/or a __init__ method for setting the members that the test code expects. These could then be documented to make it easier for future readers adding tests.

test_ros2cli/test/config_ros2msg_test.py Outdated Show resolved Hide resolved
@jacobperron
Copy link
Member

I think ros2msg, ros2srv will be deleted. Also list and show verbs of ros2action

I don't expect these to go away any time soon. ros2interface will be the recommend tool over ros2msg and ros2srv, but we may leave them for a bit to help with the transition. ros2action list will not change; it is listing action servers/clients, not action types like ros2interface will.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

I don't expect these to go away any time soon. ros2interface will be the recommend tool over ros2msg and ros2srv, but we may leave them for a bit to help with the transition. ros2action list will not change; it is listing action servers/clients, not action types like ros2interface will.

Sounds logical, thanks for clarifying.

Addressed your comments in: 3bef9d3.

@ivanpauno
Copy link
Member Author

CI (build up to test_ros2cli, test test_ros2cli, including opensplice):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

CI again, after addressing the failures (I guess ...).
(build up to test_ros2cli, test test_ros2cli, including opensplice):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

ivanpauno commented Jun 28, 2019

CI (build up to test_ros2cli, test test_ros2cli, including opensplice):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

test_ros2cli/test/config_ros2launch_test.py Outdated Show resolved Hide resolved
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

The last CI have some failures related to connext, and it seems that some verbs of the action command aren't working well with it. I will try to dig a little bit more into the problem.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

CI (build up to test_ros2cli, test test_ros2cli, including opensplice):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@ivanpauno ivanpauno changed the title Added tests for ros2action and ros2 msg Added tests for ros2action and ros2msg Jul 8, 2019
@ivanpauno
Copy link
Member Author

@hidmic @jacobperron I think this is ready for merging, but it needs a new review after last commit.

@@ -40,11 +41,16 @@ def generate_test_description(config, ready_fn):
output='screen',
sigterm_timeout=LaunchConfiguration('sigterm_timeout', default=60)
)
if '@RMW_IMPLEMENTATION@' == 'rmw_connext_cpp':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the test code is otherwise RMW agnostic, I would rather see this logic moved to the tests macro in CMakeLists.txt. Also, with a comment explaining why this is required.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

Sanity check:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'm curious, why is the delay needed for Connext? It's probably worth adding a comment.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

LGTM.

I'm curious, why is the delay needed for Connext? It's probably worth adding a comment.

Sorry, I forgot about adding the comment.
Connext startup is just too slow. I tested manually, and if you start the fibonacci_action_server and then run ros2 action list, the first few times it doesn't appear (with connext).

@ivanpauno ivanpauno merged commit ef61333 into master Jul 9, 2019
@delete-merged-branch delete-merged-branch bot deleted the ivanpauno/add-tests-for-ros2action-ros2msg branch July 9, 2019 20:25
esteve pushed a commit to esteve/ros2cli that referenced this pull request Dec 16, 2022
Signed-off-by: Audrow Nash <audrow@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants