Skip to content

Commit 6a5c50e

Browse files
evsharyKarsten1987
authored andcommitted
Fix the test failure of wrong messages count (#165)
Generate rclcpp::Node before start_recording since rclcpp::Node will set parameters of use_sim_time and publish message to parameter_events. This will cause the wrong messages count in the test. Signed-off-by: evshary <[email protected]>
1 parent 1c5f9aa commit 6a5c50e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rosbag2_transport/test/rosbag2_transport/test_record_all_no_discovery.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ TEST_F(RecordIntegrationTestFixture, record_all_without_discovery_ignores_later_
2727
auto string_message = get_messages_strings()[0];
2828
string_message->string_value = "Hello World";
2929

30+
auto publisher_node = std::make_shared<rclcpp::Node>("publisher_for_test");
31+
3032
start_recording({true, true, {}, "rmw_format", 1ms});
3133

3234
std::this_thread::sleep_for(100ms);
33-
auto publisher_node = std::make_shared<rclcpp::Node>("publisher_for_test");
3435
auto publisher = publisher_node->create_publisher<test_msgs::msg::Strings>("/string_topic", 10);
3536
for (int i = 0; i < 5; ++i) {
3637
std::this_thread::sleep_for(20ms);

0 commit comments

Comments
 (0)