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 3 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 mojomex self-assigned this Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 59.60265% with 61 lines in your changes missing coverage. Please review.

Project coverage is 5.02%. Comparing base (dc69e52) to head (ee5013f).

Files with missing lines Patch % Lines
...terfaces/test/hesai/test_ptc/tcp_socket_replay.hpp 52.17% 11 Missing and 11 partials ⚠️
...ces/nebula_hw_interfaces_hesai/connections/tcp.hpp 0.00% 20 Missing ⚠️
nebula_hw_interfaces/test/hesai/test_ptc.cpp 77.77% 8 Missing and 6 partials ⚠️
nebula_ros/src/hesai/hw_interface_wrapper.cpp 0.00% 2 Missing ⚠️
.../nebula_hesai_hw_interfaces/hesai_hw_interface.cpp 87.50% 0 Missing and 1 partial ⚠️
...ula_hw_interfaces/test/hesai/test_ptc/ptc_test.hpp 87.50% 1 Missing ⚠️
...interfaces/test/hesai/test_ptc/tcp_socket_mock.hpp 75.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (dc69e52) and HEAD (ee5013f). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (dc69e52) HEAD (ee5013f)
total 2 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #234       +/-   ##
==========================================
- Coverage   27.21%   5.02%   -22.20%     
==========================================
  Files         104      97        -7     
  Lines        9458    8321     -1137     
  Branches     2322    1578      -744     
==========================================
- Hits         2574     418     -2156     
- Misses       6449    7832     +1383     
+ Partials      435      71      -364     
Flag Coverage Δ
differential 5.02% <59.60%> (?)
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.

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]>
@mojomex mojomex mentioned this pull request Nov 28, 2024
…und transport_drivers TCP

Signed-off-by: Max SCHMELLER <[email protected]>
@mojomex mojomex force-pushed the feat/tcp-unit-tests branch from d2db773 to b4eb3b5 Compare December 24, 2024 06:39
@mojomex mojomex force-pushed the feat/tcp-unit-tests branch from b4eb3b5 to ee5013f Compare December 24, 2024 06:57
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