Use main function instead of global variable to setup the test environment.#4948
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ see 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
SteveMacenski
left a comment
There was a problem hiding this comment.
@evshary thanks for the PR!
I broadly speaking agree and approve, though I'd like an explanation for the changes in nav2_behavior_tree/test/plugins/action/test_remove_in_collision_goals_action.cpp which don't match the same changes made in the other files.
Otherwise, LGTM and happy to merge once I understand why only this one test is otherwise adjusted
|
Thank you for the review! Yes, a more detailed explanation for that should be better. In rmw_zenoh, there is a limitation in that we can't run anything in the Please let me know if you want this in a separate PR or you have any concern on this. |
|
Hi @evshary! Regarding the fix on nav2_behavior_tree/test/plugins/action/test_remove_in_collision_goals_action.cpp, I believe this patch could be a solution. diff --git a/nav2_behavior_tree/test/plugins/action/test_remove_in_collision_goals_action.cpp b/nav2_behavior_tree/test/plugins/action/test_remove_in_collision_goals_action.cpp
index 307bd6e3..ea750fe4 100644
--- a/nav2_behavior_tree/test/plugins/action/test_remove_in_collision_goals_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_remove_in_collision_goals_action.cpp
@@ -106,6 +106,7 @@ public:
config_ = nullptr;
node_.reset();
success_server_.reset();
+ failure_server_.reset();
factory_.reset();
} |
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
This reverts commit 3d0e468. Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
271ecc0 to
9c2a5e6
Compare
|
@evshary can you fix the merge conflict? Then happy to merge this in Thanks for the help to make this work well with Zenoh! |
|
This pull request is in conflict. Could you fix it @evshary? |
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
|
@SteveMacenski It's resolved now. Hope we can make rmw_zenoh pass all the tests in navigation2 in the near future 😄 |
…nment. (ros-navigation#4948) * Use the main function to setup the test environment. Signed-off-by: ChenYing Kuo <evshary@gmail.com> * Apply the modification to all the tests. Signed-off-by: ChenYing Kuo <evshary@gmail.com> * Refactor the test_remove_in_collision_goals_action. Signed-off-by: ChenYing Kuo <evshary@gmail.com> * Add the missing test items. Signed-off-by: ChenYing Kuo <evshary@gmail.com> * Revert "Refactor the test_remove_in_collision_goals_action." This reverts commit 3d0e468. Signed-off-by: ChenYing Kuo <evshary@gmail.com> * Reset failure_server_ Signed-off-by: ChenYing Kuo <evshary@gmail.com> --------- Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Basic Info
Description of contribution in a few bullet points
Now the unit test relies on using global variables to setup the environment.
For example,
navigation2/nav2_planner/test/test_dynamic_parameters.cpp
Line 60 in 4694386
I think it would be better to use the main function instead.
We discovered that while testing
rmw_zenoh.Due to the issue, rmw_zenoh couldn't shutdown in atexit stage. That means calling shutdown in the destructor of a global variable will cause panic.
We believe it would be better to avoid using global variables.
Here is the list of affected tests: ZettaScaleLabs/rmw_zenoh#54
Description of documentation updates required from your changes
Not required
Description of how this change was tested
Run the CI test.
Future work that may be required in bullet points
For Maintainers: