[hardware_interface_testing] Add tests for hardware components exception handling#3228
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3228 +/- ##
==========================================
+ Coverage 89.06% 89.62% +0.55%
==========================================
Files 160 161 +1
Lines 19751 20170 +419
Branches 1597 1602 +5
==========================================
+ Hits 17592 18077 +485
+ Misses 1493 1428 -65
+ Partials 666 665 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
f99d2ca to
8f96594
Compare
8f96594 to
c312bd2
Compare
|
@christophfroehlich @saikishor |
saikishor
left a comment
There was a problem hiding this comment.
Interesting approach. Changes LGTM, however, I'm questioning myself if we need to inject it into all 3 types of components?. Because this is something crucial if one thing works, it is same for the other two that's why.
@ros-controls/ros-controls-pmc what do you think about it?
@saikishor, thank you for the feedback. That’s a very valid point regarding the redundancy. You’re right that the underlying handler logic in My reasoning for including failure injection in all three types (Actuators, Sensors, and Systems) was primarily to achieve the high coverage targets for the ResourceManager itself. In methods like Since the goal of this task was specifically to harden the exception coverage, I opted for this more exhaustive approach to ensure no "dark spots" were left in the RM implementation. I'm happy to consolidate these tests into a single component type if you'd prefer a more concise test suite over targeting absolute coverage for every vector. |
Summary
This PR addresses Issue #1530 by providing automated verification for the hardware exception-handling logic in
ResourceManager. The goal is to ensure that plugin-level failures are handled predictably and that the core system remains stable when plugins encounter errors.Approach & Verification
Targeted Verification Suite
To resolve the task, I have added a series of automated tests to the
hardware_interface_testingsuite. I followed the maintainer suggestion of using URDF parameters (throw_on_*) to trigger failure points deterministically within existing test components. This allows us to verify:on_configure,on_activate).readandwritecyclic loops when plugins throw exceptions.catch(...)) to prevent silent crashes.Surgical Refinements for Consistency
While adding these tests, I identified and addressed a few areas for better consistency:
import_state_interfacesto align its exception handling with the established pattern for command interfaces.Review Request
I have aimed to keep these changes surgical and scoped strictly to the requirements of the issue. The new tests provide a baseline to ensure that future updates to hardware plugins or the resource manager do not regress in their error handling.
All 88 tests in the package (57 existing + 31 new/refined) are passing locally. I would appreciate your feedback on the implementation and testing strategy, particularly regarding the failure injection points in the mock components.
Verified locally with
colcon test(Screenshot attached below).