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

test(hesai): dependency-injectable TCP socket, HW interface testability #234

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

mojomex
Copy link
Collaborator

@mojomex mojomex commented Nov 22, 2024

PR Type

  • Improvement

Related Links

Description

⚠️ #231, #232, #233 have to be merged before this ⚠️

Previously, testing Nebula's HW interfaces has been difficult because all hardware drivers were hard-coded. This meant that during test time, a real network connection would have to be used, or, that LD_PRELOAD or macro trickery had to be used.

This PR adds a dependency-injectable TCP socket implementation (currently just a wrapper around transport_drivers), which allows mocking the TCP socket at test time.

Since the TCP socket is still very Hesai-specific, I have added the new socket and refactored it into nebula_ros and nebula_hw_interfaces_hesai already.

Basic unit tests to prove testability have been added. More will be added in a future PR.

Review Procedure

Remarks

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

mojomex and others added 26 commits November 22, 2024 16:23
…remove rclcpp dependency 🎉

Signed-off-by: Max SCHMELLER <[email protected]>
…es transport_drivers internally)

Signed-off-by: Max SCHMELLER <[email protected]>
@mojomex mojomex self-assigned this Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 50.83333% with 177 lines in your changes missing coverage. Please review.

Project coverage is 27.52%. Comparing base (47efeed) to head (81ad961).

Files with missing lines Patch % Lines
.../nebula_hesai_hw_interfaces/hesai_hw_interface.cpp 13.79% 50 Missing ⚠️
...es/nebula_hw_interfaces_common/connections/udp.hpp 60.83% 24 Missing and 23 partials ⚠️
nebula_hw_interfaces/test/common/test_udp.cpp 63.51% 7 Missing and 20 partials ⚠️
...ces/nebula_hw_interfaces_hesai/connections/tcp.hpp 0.00% 20 Missing ⚠️
...la_ros/include/nebula_ros/common/rclcpp_logger.hpp 0.00% 16 Missing ⚠️
...n/include/nebula_common/loggers/console_logger.hpp 0.00% 8 Missing ⚠️
...ebula_hw_interfaces/test/common/test_udp/utils.hpp 84.00% 0 Missing and 4 partials ⚠️
nebula_ros/src/hesai/hw_interface_wrapper.cpp 0.00% 3 Missing ⚠️
...ula_hw_interfaces/test/hesai/test_ptc/ptc_test.hpp 87.50% 1 Missing ⚠️
...ula_hw_interfaces/test/hesai/test_ptc/tcp_mock.hpp 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   26.10%   27.52%   +1.42%     
==========================================
  Files         100      109       +9     
  Lines        9218     9481     +263     
  Branches     2215     2770     +555     
==========================================
+ Hits         2406     2610     +204     
- Misses       6423     6433      +10     
- Partials      389      438      +49     
Flag Coverage Δ
differential 27.52% <50.83%> (?)
total ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Signed-off-by: Max SCHMELLER <[email protected]>
mojomex added a commit that referenced this pull request Nov 26, 2024
Signed-off-by: Max SCHMELLER <[email protected]>
mojomex added a commit that referenced this pull request Nov 26, 2024
Signed-off-by: Max SCHMELLER <[email protected]>
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.

1 participant