Skip to content

Commit

Permalink
Address flakiness in TestRosbag2CPPAPI::minimal_writer_example
Browse files Browse the repository at this point in the history
- The `serialized_msg2` is not owning the serialized data after the
first call writer.write(serialized_msg2,..). i.e. need to use another
message or another API in test for second call to writer.write(msg).

Signed-off-by: Michael Orlov <[email protected]>
  • Loading branch information
MichaelOrlov committed May 21, 2024
1 parent a64af18 commit 7081a65
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rosbag2_tests/test/rosbag2_tests/test_rosbag2_cpp_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ TEST_P(TestRosbag2CPPAPI, minimal_writer_example)
writer.open(rosbag_directory_next.string());

// write same topic to different bag
writer.write(
serialized_msg2, "/yet/another/topic", "test_msgs/msg/BasicTypes",
rclcpp::Clock().now());
writer.write(bag_message, "/my/other/topic", "test_msgs/msg/BasicTypes");

// close by scope
}
Expand Down Expand Up @@ -152,7 +150,7 @@ TEST_P(TestRosbag2CPPAPI, minimal_writer_example)
&extracted_serialized_msg, &extracted_test_msg);

EXPECT_EQ(test_msg, extracted_test_msg);
EXPECT_EQ("/yet/another/topic", topic);
EXPECT_EQ("/my/other/topic", topic);
}

// alternative reader
Expand Down

0 comments on commit 7081a65

Please sign in to comment.