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 5 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

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 60.00000% with 60 lines in your changes missing coverage. Please review.

Project coverage is 29.84%. Comparing base (8d6aec1) to head (7aa6999).

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 ⚠️
...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 ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   29.28%   29.84%   +0.56%     
==========================================
  Files         112      117       +5     
  Lines        9733     9731       -2     
  Branches     3252     2726     -526     
==========================================
+ Hits         2850     2904      +54     
+ Misses       6359     6325      -34     
+ Partials      524      502      -22     
Flag Coverage Δ
differential 29.84% <60.00%> (?)
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
@mojomex mojomex force-pushed the feat/tcp-unit-tests branch 2 times, most recently from b4eb3b5 to ee5013f Compare December 24, 2024 06:57
@mojomex mojomex requested a review from drwnz January 16, 2025 08:29
@mojomex mojomex force-pushed the feat/tcp-unit-tests branch from ee5013f to 7ad2fd2 Compare February 20, 2025 01:45
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