From 48d3603018947eb05050fe875c671470da9d7c16 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Tue, 28 Jul 2020 14:58:37 -0700 Subject: [PATCH] fix node graph test with Connext and CycloneDDS returning actual data (#1245) * fix node graph test with Connext and CycloneDDS returning actual data Signed-off-by: Dirk Thomas * use ADD_FAILURE() Signed-off-by: Dirk Thomas --- .../node_interfaces/test_node_graph.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/rclcpp/test/rclcpp/node_interfaces/test_node_graph.cpp b/rclcpp/test/rclcpp/node_interfaces/test_node_graph.cpp index db69207..c29b245 100644 --- a/rclcpp/test/rclcpp/node_interfaces/test_node_graph.cpp +++ b/rclcpp/test/rclcpp/node_interfaces/test_node_graph.cpp @@ -170,10 +170,28 @@ TEST_F(TestNodeGraph, get_info_by_topic) EXPECT_EQ(rclcpp::EndpointType::Publisher, const_publisher_endpoint_info.endpoint_type()); rclcpp::QoS actual_qos = publisher_endpoint_info.qos_profile(); - EXPECT_EQ(0u, actual_qos.get_rmw_qos_profile().depth); + switch (actual_qos.get_rmw_qos_profile().history) { + case RMW_QOS_POLICY_HISTORY_KEEP_LAST: + EXPECT_EQ(1u, actual_qos.get_rmw_qos_profile().depth); + break; + case RMW_QOS_POLICY_HISTORY_UNKNOWN: + EXPECT_EQ(0u, actual_qos.get_rmw_qos_profile().depth); + break; + default: + ADD_FAILURE() << "unexpected history"; + } rclcpp::QoS const_actual_qos = const_publisher_endpoint_info.qos_profile(); - EXPECT_EQ(0u, const_actual_qos.get_rmw_qos_profile().depth); + switch (const_actual_qos.get_rmw_qos_profile().history) { + case RMW_QOS_POLICY_HISTORY_KEEP_LAST: + EXPECT_EQ(1u, const_actual_qos.get_rmw_qos_profile().depth); + break; + case RMW_QOS_POLICY_HISTORY_UNKNOWN: + EXPECT_EQ(0u, const_actual_qos.get_rmw_qos_profile().depth); + break; + default: + ADD_FAILURE() << "unexpected history"; + } auto endpoint_gid = publisher_endpoint_info.endpoint_gid(); auto const_endpoint_gid = const_publisher_endpoint_info.endpoint_gid();