From 253a703aee2f6b0c55c4796598750e57cb1be24f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 08:12:55 -0700 Subject: [PATCH] [humble] Fix for a false negative integration test with bag split in recorder (backport #1743) (#1751) * Fix for a false negative integration test with bag split in recorder (#1743) - In record_end_to_end_with_splitting_bagsize_split_is_at_least_specified_size publisher was starting after terminating recorder. Signed-off-by: Michael Orlov (cherry picked from commit da1acb29646258899ba73a81c803383c07905613) # Conflicts: # rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp * Address merge conflicts Signed-off-by: Michael Orlov --------- Signed-off-by: Michael Orlov Co-authored-by: Michael Orlov --- .../rosbag2_tests/test_rosbag2_record_end_to_end.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp b/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp index 515b8163e7..86575cf5cf 100644 --- a/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp +++ b/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp @@ -326,13 +326,13 @@ TEST_F(RecordFixture, record_end_to_end_with_splitting_bagsize_split_is_at_least ASSERT_TRUE(pub_manager.wait_for_matched(topic_name)) << "Expected find rosbag subscription"; + pub_manager.run_publishers(); + wait_for_db(); stop_execution(process_handle); cleanup_process_handle.cancel(); - pub_manager.run_publishers(); - rosbag2_storage::MetadataIo metadata_io; #ifdef _WIN32 @@ -357,10 +357,7 @@ TEST_F(RecordFixture, record_end_to_end_with_splitting_bagsize_split_is_at_least const auto metadata = metadata_io.read_metadata(root_bag_path_.string()); const auto actual_splits = static_cast(metadata.files.size()); - // TODO(zmichaels11): Support reliable sync-to-disk for more accurate splits. - // The only guarantee with splits right now is that they will not occur until - // a bagfile is at least the specified max_bagfile_size. - EXPECT_GT(actual_splits, 0); + EXPECT_EQ(actual_splits, expected_splits); // Don't include the last bagfile since it won't be full for (int i = 0; i < actual_splits - 1; ++i) {