Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(fake_test_node): prefix package and namespace with autoware #9249

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ common/autoware_adapi_specs/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp
common/autoware_auto_common/** opensource@apex.ai satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp
common/autoware_component_interface_specs/** isamu.takagi@tier4.jp yukihiro.saito@tier4.jp
common/autoware_component_interface_tools/** isamu.takagi@tier4.jp
common/autoware_fake_test_node/** opensource@apex.ai satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp
common/autoware_geography_utils/** koji.minoda@tier4.jp
common/autoware_goal_distance_calculator/** taiki.tanaka@tier4.jp
common/autoware_grid_map_utils/** maxime.clement@tier4.jp
Expand All @@ -27,7 +28,6 @@ common/autoware_universe_utils/** mamoru.sobue@tier4.jp takamasa.horibe@tier4.jp
common/autoware_vehicle_info_utils/** mamoru.sobue@tier4.jp shumpei.wakabayashi@tier4.jp taiki.tanaka@tier4.jp tomoya.kimura@tier4.jp
common/bag_time_manager_rviz_plugin/** taiki.tanaka@tier4.jp
common/component_interface_utils/** isamu.takagi@tier4.jp yukihiro.saito@tier4.jp
common/fake_test_node/** opensource@apex.ai satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp
common/global_parameter_loader/** ryohsuke.mitsudome@tier4.jp
common/glog_component/** takamasa.horibe@tier4.jp
common/tier4_adapi_rviz_plugin/** hiroki.ota@tier4.jp isamu.takagi@tier4.jp kosuke.takeuchi@tier4.jp
Expand Down
2 changes: 1 addition & 1 deletion common/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ nav:
- 'Introduction': common
- 'Testing Libraries':
- 'autoware_testing': common/autoware_testing/design/autoware_testing-design
- 'fake_test_node': common/fake_test_node/design/fake_test_node-design
- 'autoware_fake_test_node': common/autoware_fake_test_node/design/fake_test_node-design
- 'Test Utils': common/autoware_test_utils
- 'Common Libraries':
- 'autoware_auto_common':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 3.14)
project(fake_test_node)
project(autoware_fake_test_node)

find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_library(fake_test_node SHARED src/fake_test_node.cpp)
ament_auto_add_library(${PROJECT_NAME} SHARED src/fake_test_node.cpp)

if(BUILD_TESTING)
ament_add_ros_isolated_gtest(test_fake_test_node
test/test_fake_test_node.cpp
)
add_dependencies(test_fake_test_node fake_test_node)
target_link_libraries(test_fake_test_node fake_test_node)
add_dependencies(test_fake_test_node ${PROJECT_NAME})
target_link_libraries(test_fake_test_node ${PROJECT_NAME})
endif()

ament_auto_package()
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ fixture.
This package contains a library that introduces two utility classes that can be used in place of
custom fixtures described above to write integration tests for a node:

- `autoware::tools::testing::FakeTestNode` - to use as a custom test fixture with `TEST_F` tests
- `autoware::tools::testing::FakeTestNodeParametrized` - to use a custom test fixture with the
- `autoware::fake_test_node::FakeTestNode` - to use as a custom test fixture with `TEST_F` tests
- `autoware::fake_test_node::FakeTestNodeParametrized` - to use a custom test fixture with the
parametrized `TEST_P` tests (accepts a template parameter that gets forwarded to
`testing::TestWithParam<T>`)

Expand All @@ -30,10 +30,10 @@ Let's say there is a node `NodeUnderTest` that requires testing. It just
subscribes to `std_msgs::msg::Int32` messages and publishes a
`std_msgs::msg::Bool` to indicate that the input is positive. To test such a
node the following code can be used utilizing the
`autoware::tools::testing::FakeTestNode`:
`autoware::fake_test_node::FakeTestNode`:

```cpp
using FakeNodeFixture = autoware::tools::testing::FakeTestNode;
using FakeNodeFixture = autoware::fake_test_node::FakeTestNode;

/// @test Test that we can use a non-parametrized test.
TEST_F(FakeNodeFixture, Test) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
/// \copyright Copyright 2021 Apex.AI, Inc.
/// All rights reserved.

#ifndef FAKE_TEST_NODE__FAKE_TEST_NODE_HPP_
#define FAKE_TEST_NODE__FAKE_TEST_NODE_HPP_
#ifndef AUTOWARE__FAKE_TEST_NODE__FAKE_TEST_NODE_HPP_
#define AUTOWARE__FAKE_TEST_NODE__FAKE_TEST_NODE_HPP_

#include <fake_test_node/visibility_control.hpp>
#include <autoware/fake_test_node/visibility_control.hpp>
#include <rclcpp/rclcpp.hpp>

#include <gtest/gtest.h>
Expand All @@ -30,11 +30,7 @@
#include <string>
#include <type_traits>

namespace autoware
{
namespace tools
{
namespace testing
namespace autoware::fake_test_node
{

///
Expand Down Expand Up @@ -237,8 +233,6 @@ class FAKE_TEST_NODE_PUBLIC FakeTestNode : public detail::FakeNodeCore, public :
void TearDown() override;
};

} // namespace testing
} // namespace tools
} // namespace autoware
} // namespace autoware::fake_test_node

#endif // FAKE_TEST_NODE__FAKE_TEST_NODE_HPP_
#endif // AUTOWARE__FAKE_TEST_NODE__FAKE_TEST_NODE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
/// \copyright Copyright 2021 Apex.AI, Inc.
/// All rights reserved.

#ifndef FAKE_TEST_NODE__VISIBILITY_CONTROL_HPP_
#define FAKE_TEST_NODE__VISIBILITY_CONTROL_HPP_
#ifndef AUTOWARE__FAKE_TEST_NODE__VISIBILITY_CONTROL_HPP_
#define AUTOWARE__FAKE_TEST_NODE__VISIBILITY_CONTROL_HPP_

////////////////////////////////////////////////////////////////////////////////
#if defined(__WIN32)
Expand All @@ -39,4 +39,4 @@
#error "Unsupported Build Configuration"
#endif // defined(__WIN32)

#endif // FAKE_TEST_NODE__VISIBILITY_CONTROL_HPP_
#endif // AUTOWARE__FAKE_TEST_NODE__VISIBILITY_CONTROL_HPP_
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>fake_test_node</name>
<name>autoware_fake_test_node</name>
<version>0.38.0</version>
<description>A fake node that we can use in the integration-like cpp tests.</description>
<maintainer email="opensource@apex.ai">Apex.AI, Inc.</maintainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
/// \copyright Copyright 2021 Apex.AI, Inc.
/// All rights reserved.

#include <fake_test_node/fake_test_node.hpp>
#include <autoware/fake_test_node/fake_test_node.hpp>

#include <memory>
#include <string>

namespace
namespace autoware::fake_test_node
{
constexpr auto kSpinThread = false;
constexpr auto kArgc = 0;
Expand All @@ -34,15 +34,6 @@ std::string sanitize_test_name(const std::string & name)
return sanitize_test_name;
}

} // namespace

namespace autoware
{
namespace tools
{
namespace testing
{

void detail::FakeNodeCore::set_up(const std::string & test_name)
{
ASSERT_FALSE(rclcpp::ok());
Expand Down Expand Up @@ -76,6 +67,4 @@ void FakeTestNode::TearDown()
tear_down();
}

} // namespace testing
} // namespace tools
} // namespace autoware
} // namespace autoware::fake_test_node
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// \copyright Copyright 2021 Apex.AI, Inc.
/// All rights reserved.

#include <fake_test_node/fake_test_node.hpp>
#include <autoware/fake_test_node/fake_test_node.hpp>

#include <std_msgs/msg/bool.hpp>
#include <std_msgs/msg/int32.hpp>
Expand All @@ -30,8 +30,8 @@

using bool8_t = bool;

using FakeNodeFixture = autoware::tools::testing::FakeTestNode;
using FakeNodeFixtureParametrized = autoware::tools::testing::FakeTestNodeParametrized<bool8_t>;
using FakeNodeFixture = autoware::fake_test_node::FakeTestNode;
using FakeNodeFixtureParametrized = autoware::fake_test_node::FakeTestNodeParametrized<bool8_t>;
using std_msgs::msg::Bool;
using std_msgs::msg::Int32;

Expand Down
2 changes: 1 addition & 1 deletion control/autoware_trajectory_follower_node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(BUILD_TESTING)
test/trajectory_follower_test_utils.hpp
test/test_controller_node.cpp
)
ament_target_dependencies(${TRAJECTORY_FOLLOWER_NODES_TEST} fake_test_node)
ament_target_dependencies(${TRAJECTORY_FOLLOWER_NODES_TEST} autoware_fake_test_node)
target_link_libraries(
${TRAJECTORY_FOLLOWER_NODES_TEST} ${CONTROLLER_NODE})

Expand Down
2 changes: 1 addition & 1 deletion control/autoware_trajectory_follower_node/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<test_depend>ament_index_cpp</test_depend>
<test_depend>ament_index_python</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_fake_test_node</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>autoware_testing</test_depend>
<test_depend>fake_test_node</test_depend>
<test_depend>ros_testing</test_depend>

<export>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "autoware/fake_test_node/fake_test_node.hpp"
#include "autoware/trajectory_follower_node/controller_node.hpp"
#include "fake_test_node/fake_test_node.hpp"
#include "gtest/gtest.h"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp/time.hpp"
Expand Down Expand Up @@ -42,7 +42,7 @@ using SteeringReport = autoware_vehicle_msgs::msg::SteeringReport;
using autoware_adapi_v1_msgs::msg::OperationModeState;
using geometry_msgs::msg::AccelWithCovarianceStamped;

using FakeNodeFixture = autoware::tools::testing::FakeTestNode;
using FakeNodeFixture = autoware::fake_test_node::FakeTestNode;

const rclcpp::Duration one_second(1, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef TRAJECTORY_FOLLOWER_TEST_UTILS_HPP_
#define TRAJECTORY_FOLLOWER_TEST_UTILS_HPP_

#include "fake_test_node/fake_test_node.hpp"
#include "autoware/fake_test_node/fake_test_node.hpp"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp/time.hpp"
#include "tf2_ros/static_transform_broadcaster.h"
Expand All @@ -27,7 +27,7 @@

namespace test_utils
{
using FakeNodeFixture = autoware::tools::testing::FakeTestNode;
using FakeNodeFixture = autoware::fake_test_node::FakeTestNode;

inline void waitForMessage(
const std::shared_ptr<rclcpp::Node> & node, FakeNodeFixture * fixture, const bool & received_flag,
Expand Down
2 changes: 1 addition & 1 deletion planning/autoware_path_optimizer/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_index_python</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_fake_test_node</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>autoware_testing</test_depend>
<test_depend>fake_test_node</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
2 changes: 1 addition & 1 deletion planning/autoware_path_smoother/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_index_python</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_fake_test_node</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>autoware_testing</test_depend>
<test_depend>fake_test_node</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_index_python</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_fake_test_node</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>autoware_testing</test_depend>
<test_depend>fake_test_node</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
Loading