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

Add tests to ROS node #10

Merged
merged 10 commits into from
Jan 10, 2023
Merged

Conversation

agalbachicar
Copy link
Collaborator

🎉 New feature

Part of #1

Goes on top of #8

Summary

Adds test coverage to the ROS2 and MaliputQuery. To do, I've done the following:

  • Created a header file to have mock support for all RoadNetwork entities.
  • Created a few methods to handle the pointers of the created mocks and a plugin to be injected into the node.
  • Tested MaliputQuery.
  • Tested MaliputQueryNode

In the process learned that there should be a ros2 way to indicate a service call has failed, I'll do that in a follow up PR.

Test it

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if it affects the public API)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

- Creates MaliputQueryNode as a ROS2 proxy to make RoadNetwork queries.
- Provides a sample configuration file use maliput_malidrive.

Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Copy link
Contributor

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

Great job on testing. I left some comments ptal

maliput_ros/test/maliput_ros/ros/maliput_mock.h Outdated Show resolved Hide resolved
Comment on lines +255 to +256
rclcpp::Event::SharedPtr graph_event = node->get_graph_event();
node->wait_for_graph_change(graph_event, sleep_period);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to fully understand the logic here, which are the graph events here? RElated to the lifecycle states?

node->wait_for_graph_change(graph_event, sleep_period);

Are we waiting here for the graph_event to happen? or are we waiting to change from graph_event instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • NodeInterface::get_graph_event() returns an event that will be set when the event occurs.
  • NodeInterface::wait_for_graph_change() waits for graph_event to be set.

We are waiting for an event to occur.

Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
@agalbachicar
Copy link
Collaborator Author

Interestingly, maliput_ros_interfaces failed at bf1e6ed

[...]
  Summary: 3 packages finished [34.7s]
    1 package had stderr output: maliput_ros_interfaces
    1 package had test failures: maliput_ros_interfaces

pep 257 check failed in one of the tests that the code generation automatically creates.

@agalbachicar agalbachicar marked this pull request as ready for review January 7, 2023 13:18
francocipollone
francocipollone previously approved these changes Jan 8, 2023
Copy link
Contributor

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

LGTM! Only CI is missing to pass

@agalbachicar agalbachicar mentioned this pull request Jan 9, 2023
6 tasks
Copy link
Contributor

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

LGTM

@agalbachicar agalbachicar merged commit c3818ef into main Jan 10, 2023
@agalbachicar agalbachicar deleted the agalbachicar/#1_add_tests_to_ros_node branch January 10, 2023 17:26
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

Successfully merging this pull request may close these issues.

2 participants