Skip to content

get_parameters should be similar as get_parameter to throw ParameterUninitializedException #2038

@iuhilnehc-ynos

Description

@iuhilnehc-ynos

Bug report

Required Info:

  • Operating System:
    • Ubuntu22.04
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

add test case in https://github.com/ros2/rclcpp/blob/edbfe1404b24d0bc85ff88e8ff1f006670788e46/rclcpp/test/rclcpp/test_node.cpp

diff --git a/rclcpp/test/rclcpp/test_node.cpp b/rclcpp/test/rclcpp/test_node.cpp
index c40811a4..2ccbdfd8 100644
--- a/rclcpp/test/rclcpp/test_node.cpp
+++ b/rclcpp/test/rclcpp/test_node.cpp
@@ -3346,6 +3346,9 @@ TEST_F(TestNode, static_and_dynamic_typing) {
     EXPECT_THROW(
       node->get_parameter("integer_override_not_given"),
       rclcpp::exceptions::ParameterUninitializedException);
+    EXPECT_THROW(
+      node->get_parameters({"integer_override_not_given"}),
+      rclcpp::exceptions::ParameterUninitializedException);
   }
   {
     auto param = node->declare_parameter("integer_set_after_declare", rclcpp::PARAMETER_INTEGER);

NOTE: refer to rclpy

Expected behavior

test case passed

Actual behavior

failed with log

[ RUN      ] TestNode.static_and_dynamic_typing
/home/chenlh/Projects/ROS2/ros2-master/src/ros2/rclcpp/rclcpp/test/rclcpp/test_node.cpp:3349: Failure
Expected: node->get_parameters({"integer_override_not_given"}) throws an exception of type rclcpp::exceptions::ParameterUninitializedException.
  Actual: it throws nothing.
[  FAILED  ] TestNode.static_and_dynamic_typing (20 ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions