Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a adjustement fix for the test regressions appeared in
test_communication
andtest_security
after applying newrclcpp::Rate
API (ros2/rclcpp#2123).The new
rclcpp::Rate
API after the change implies that RCLCPP context should exist at therate.sleep()
call time. However, internal test publisher's logic does not destroy theRate
objects after RCLCPP was stopped, which causes a runtime exceptions. Moreover, there are some tests (named**AfterShutdown
), that intentionally runs the subscriber and publisher nodes (withrclcpp::Rate
working inside) after the context was stopped and checks that everything is just closed correctly. This in our case is also causing the same run-time exception.Thus, without large test modification, it is seems to be impossible to fix it by just changing the
rclcpp::Rate
usage logic. Therefore, it was chosen to handle thecontext cannot be slept with because it's invalid
exceptions appears during therclcpp::Rate
usage w/o context. This exception raises in two cases described above, when test was already finished. So, this should be a simpler way to handle this, I suppose.