Repository navigation
Open
Labels
Description
Summary
The project currently has no unit tests (only one integration/launch test exists). Tests should be added to ensure correctness and prevent regressions.
Scope
Unit tests (pure logic, via ament_add_ros_isolated_gtest)
-
cie_thread_configurator::create_callback_group_id: self-contained string-ID generation; good starting point -
MultiThreadedExecutorInternalstate machine / error handling:pre_spin()called twice throws,spin()withoutpre_spin()throws,get_thread_ids()withoutpre_spin()throws, andget_thread_ids()returns N unique TIDs -
CallbackIsolatedExecutoradd/remove/get bookkeeping for callback groups and nodes- Duplicate detection currently calls
exit(EXIT_FAILURE), so these paths need gtest death tests (EXPECT_EXIT) unless they are converted to exceptions first (see Testability refactors below) - The constructor calls
create_client_publisher(), sorclcpp::init()is required; this is not a pure unit test
- Duplicate detection currently calls
-
ThreadConfiguratorNodeYAML/config parsing and error paths (emptyconfig_file, unknown scheduling policy, malformed YAML, hardware mismatch)- Requires extracting the parsing logic out of the constructor to make it testable
-
PrerunNodedump_yaml_configoutput and duplicate-ID detection
Integration tests (via launch_testing)
- Minimal pub/sub exercising
CallbackIsolatedExecutordirectly (test_cie_pubsub.launch.py): test(cie): add minimal pub/sub launch_testing for CIE #57 - Component container path end-to-end (
ComponentManagerCallbackIsolated/ composable nodes)add_node_to_executor/remove_node_from_executorare protected overrides driven only throughComponentManager's load/unload services, so this is inherently integration rather than unit. The previously separate "unit test forComponentManagerCallbackIsolated" item is folded in here; onlyis_clock_callback_groupis unit-sized.
- Non-ROS thread path end-to-end (
spawn_non_ros2_thread->NonRosThreadInfo->non_ros_thread_callbackinThreadConfiguratorNode/PrerunNode)
CI
- Extend the
build-and-testworkflow to also run gtest unit tests (it currently runscolcon test ... -L launch_test, soament_add_gtesttargets are never executed) - Widen
--packages-selectto also covercie_thread_configurator(onlycallback_isolated_executoris tested today, so unit tests added to the configurator package would not run otherwise)
Activity
[-]feat: Add tests for the CMake macro for registering nodes with CIE[/-][+]feat: Add unit and integration tests[/+]ran2810 commentedon Jun 23, 2026
@atsushi421: I'd like to help with this. I see a test/ folder already exists — could you clarify which of the scoped items are already covered and which are still open?
atsushi421 commentedon Jun 23, 2026
Thanks for offering to help, @ran2810! 🙏
Current status:
test_cie_pubsub.launch.py), which exercisesCallbackIsolatedExecutordirectly.-L launch_test).If you're looking for a good starting point, unit tests for
cie_thread_configurator(e.g.create_callback_group_id) are the most self-contained. Feel free to pick any item and open a PR, happy to review.ran2810 commentedon Jun 23, 2026
Thanks @atsushi421 ! I'll start with unit tests for cie_thread_configurator, focusing on create_callback_group_id in util.cpp as suggested. Following the ament_add_ros_isolated_gtest pattern. Will open a PR shortly.
[-]feat: Add unit and integration tests[/-][+]test: add unit and integration tests[/+]ran2810 commentedon Jun 23, 2026
Opened #58 with unit tests for create_callback_group_id (the first unit-test item). It covers the namespace handling, trailing-separator strip, timer period formatting, and overload equivalence, using ament_add_ros_isolated_gtest.
ran2810 commentedon Jun 25, 2026
#58 (merged) covers the cie_thread_configurator unit-test item — the create_callback_group_id tests. The other items (executor unit tests, integration tests, CI integration) are still open.