Skip to content

Commit

Permalink
Use gtest instead of launch_testing for integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
fmauch committed Aug 15, 2024
1 parent a117f8c commit 723a896
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 404 deletions.
8 changes: 0 additions & 8 deletions controller_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ if(BUILD_TESTING)
controller_manager_msgs
)

install(FILES test/test_controllers.yaml
DESTINATION test)

find_package(launch_testing_ament_cmake REQUIRED)
add_launch_test(test/test_spawner_integration.py
TIMEOUT 180
)

find_package(ament_cmake_pytest REQUIRED)
install(FILES test/test_ros2_control_node.yaml
DESTINATION test)
Expand Down
2 changes: 0 additions & 2 deletions controller_manager/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
<test_depend>ament_cmake_gmock</test_depend>
<test_depend>ament_cmake_pytest</test_depend>
<test_depend>hardware_interface_testing</test_depend>
<test_depend>launch_testing_ament_cmake</test_depend>
<test_depend>python3-coverage</test_depend>
<test_depend>ros2_control_test_assets</test_depend>
<test_depend>xacro</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
105 changes: 0 additions & 105 deletions controller_manager/test/test_controllers.yaml

This file was deleted.

194 changes: 0 additions & 194 deletions controller_manager/test/test_spawner_integration.py

This file was deleted.

26 changes: 26 additions & 0 deletions controller_manager/test/test_spawner_unspawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,32 @@ TEST_F(TestLoadController, spawner_test_fallback_controllers)
}
}

TEST_F(TestLoadController, spawner_with_many_controllers)
{
std::stringstream ss;
const size_t num_controllers = 50;
const std::string controller_base_name = "ctrl_";
for (size_t i = 0; i < num_controllers; i++)
{
std::string controller_name = controller_base_name + std::to_string(static_cast<int>(i));
cm_->set_parameter(
rclcpp::Parameter(controller_name + ".type", test_controller::TEST_CONTROLLER_CLASS_NAME));
ss << controller_name << " ";
}

ControllerManagerRunner cm_runner(this);
EXPECT_EQ(call_spawner(ss.str() + " -c test_controller_manager"), 0);

ASSERT_EQ(cm_->get_loaded_controllers().size(), num_controllers);

for (size_t i = 0; i < num_controllers; i++)
{
auto ctrl = cm_->get_loaded_controllers()[i];
ASSERT_EQ(ctrl.info.type, test_controller::TEST_CONTROLLER_CLASS_NAME);
ASSERT_EQ(ctrl.c->get_state().id(), lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE);
}
}

class TestLoadControllerWithoutRobotDescription
: public ControllerManagerFixture<controller_manager::ControllerManager>
{
Expand Down
4 changes: 0 additions & 4 deletions ros2_control_test_assets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ install(
DIRECTORY include/
DESTINATION include/ros2_control_test_assets
)
install(
DIRECTORY urdf
DESTINATION share/${PROJECT_NAME}
)
install(TARGETS ros2_control_test_assets
EXPORT export_ros2_control_test_assets
ARCHIVE DESTINATION lib
Expand Down
Loading

0 comments on commit 723a896

Please sign in to comment.