-
Notifications
You must be signed in to change notification settings - Fork 519
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
Enable rosbridge_library test in CI #686
Conversation
@jtbandes I think the test might be stuck in a deadlock on this line:
In the websocket server all calls to A short term fix might be to modify the test that is timed out to run its service call in a background thread instead of the main thread. Longer term this relates back to the discussion from #669 regarding a better architecture for this code using ROS2 async patterns instead of threads. |
It is not quite in a deadlock. The issue is that nothing is calling Here is a quick way to get diff --git a/rosbridge_library/test/internal/test_services.py b/rosbridge_library/test/internal/test_services.py
index d96638b..42a2dea 100755
--- a/rosbridge_library/test/internal/test_services.py
+++ b/rosbridge_library/test/internal/test_services.py
@@ -2,6 +2,7 @@
import random
import time
import unittest
+import threading
import numpy as np
import rclpy
@@ -146,6 +147,10 @@ class TestServices(unittest.TestCase):
ret = p.call_async(ListParameters.Request())
rclpy.spin_until_future_complete(self.node, ret)
+ # Spin in a separate thread
+ thread = threading.Thread(target=rclpy.spin, args=(self.node, ), daemon=True)
+ thread.start()
+
# Now, call using the services
json_ret = services.call_service(self.node, self.node.get_name() + "/list_parameters")
for x, y in zip(ret.result().result.names, json_ret["result"]["names"]): Apply that patch and comment out the other blocking tests and you will see that it runs. For the purpose of fixing this test, it may be possible to do something like this: Also, using a multithreaded executor may fix the issue but I have not tried that out.
Agreed |
Going to merge the fix for now and we can work on enabling the test in a follow-up PR. cc @kenji-miyake who worked on this test previously |
Another test issue was encountered on the ros build farm, and it turns out the test wasn't even running with
colcon test
, nor in this repo's CI job. I don't know why it's necessary, but addingfind_package(ament_cmake_ros REQUIRED)
to the package's CMakeLists seems to fix the issue.I've been testing locally with: