From 41d5f24425f75bc85f4b9b13b6af8237b43dfa12 Mon Sep 17 00:00:00 2001 From: brawner Date: Fri, 31 Jul 2020 13:33:51 -0700 Subject: [PATCH] Adjust test_static_executor_entities_collector for rmw_connext_cpp (#1251) It turns out rmw_connext_cpp adds a default waitable that other rmw implementations do not. Adjusting the unit test to take this into account in a non-rmw specific manner. Signed-off-by: Stephen Brawner --- .../executors/test_static_executor_entities_collector.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rclcpp/test/rclcpp/executors/test_static_executor_entities_collector.cpp b/rclcpp/test/rclcpp/executors/test_static_executor_entities_collector.cpp index 673df6c..92ded7f 100644 --- a/rclcpp/test/rclcpp/executors/test_static_executor_entities_collector.cpp +++ b/rclcpp/test/rclcpp/executors/test_static_executor_entities_collector.cpp @@ -227,7 +227,7 @@ public: TEST_F(TestStaticExecutorEntitiesCollector, add_remove_node_with_entities) { auto node = std::make_shared("node", "ns"); - const auto expected_number_of_entities = get_number_of_default_entities(node); + auto expected_number_of_entities = get_number_of_default_entities(node); EXPECT_NE(nullptr, expected_number_of_entities); // Create 1 of each entity type @@ -244,6 +244,10 @@ TEST_F(TestStaticExecutorEntitiesCollector, add_remove_node_with_entities) { test_msgs::srv::Empty::Response::SharedPtr) {}); auto client = node->create_client("service"); auto waitable = std::make_shared(); + + // Adding a subscription with rmw_connext_cpp adds another waitable, so we need to get the + // current number of waitables just before adding the new waitable. + expected_number_of_entities->waitables = get_number_of_default_entities(node)->waitables; node->get_node_waitables_interface()->add_waitable(waitable, nullptr); entities_collector_->add_node(node->get_node_base_interface());