Skip to content

Commit 1e3ba4b

Browse files
rotuKarsten1987
authored andcommitted
Only fail on unexpected /string_topic messages (#178)
I found that this test was failing on CycloneDDS because some unrelated node was publishing on the `parameter_events` topic, and these were getting caught up in the bag, and failing the test. Signed-off-by: Dan Rose <[email protected]>
1 parent 45fe111 commit 1e3ba4b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rosbag2_transport/test/rosbag2_transport/test_record_all_no_discovery.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
TEST_F(RecordIntegrationTestFixture, record_all_without_discovery_ignores_later_announced_topics)
2626
{
27+
auto topic = "/string_topic";
2728
auto string_message = get_messages_strings()[0];
2829
string_message->string_value = "Hello World";
2930

@@ -32,12 +33,13 @@ TEST_F(RecordIntegrationTestFixture, record_all_without_discovery_ignores_later_
3233
start_recording({true, true, {}, "rmw_format", 1ms});
3334

3435
std::this_thread::sleep_for(100ms);
35-
auto publisher = publisher_node->create_publisher<test_msgs::msg::Strings>("/string_topic", 10);
36+
auto publisher = publisher_node->create_publisher<test_msgs::msg::Strings>(topic, 10);
3637
for (int i = 0; i < 5; ++i) {
3738
std::this_thread::sleep_for(20ms);
3839
publisher->publish(*string_message);
3940
}
4041
stop_recording();
4142

42-
ASSERT_THAT(writer_->get_messages(), SizeIs(0));
43+
auto recorded_topics = writer_->get_topics();
44+
EXPECT_EQ(0u, recorded_topics.count(topic));
4345
}

0 commit comments

Comments
 (0)