Skip to content

Commit

Permalink
test: fix not to check messages order in ROS 2 sub
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushi421 committed Feb 4, 2025
1 parent 2e1ecfb commit 77aabf4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/e2e_test/test/test_1to1_with_ros2sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ def test_sub(self, proc_output, test_sub):

def test_ros2_sub(self, proc_output, test_ros2_sub):
with launch_testing.asserts.assertSequentialStdout(proc_output, process=test_ros2_sub) as cm:
# Check the order of messages received
stdout_content = "".join(cm._output)

# In ROS 2 subscription, not check the order of messages received
for i in range(EXPECT_INIT_PUB_NUM - EXPECT_INIT_ROS2_SUB_NUM, EXPECT_ROS2_SUB_NUM):
cm.assertInStdout(f"Receiving {i}.")
cm.assertInStdout("All messages received. Shutting down.")
self.assertIn(f"Receiving {i}.", stdout_content)
self.assertIn("All messages received. Shutting down.", stdout_content)

# Check the number of messages received
sub_count = "".join(cm._output).count("Receiving ")
sub_count = stdout_content.count("Receiving ")
self.assertEqual(sub_count, EXPECT_INIT_ROS2_SUB_NUM + EXPECT_ROS2_SUB_NUM)

0 comments on commit 77aabf4

Please sign in to comment.