Skip to content

Commit

Permalink
Refs #22055: Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Dec 10, 2024
1 parent d046bdf commit 9d5f9ba
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions test/blackbox/common/BlackboxTestsTransportTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,9 +1394,8 @@ TEST_P(TransportTCP, tcp_unique_network_flows_init)
PropertyPolicy properties;
properties.properties().emplace_back("fastdds.unique_network_flows", "");

auto transport_desc = std::make_shared<eprosima::fastdds::rtps::TCPv4TransportDescriptor>();
transport_desc->add_listener_port(global_port);
writer.disable_builtin_transport().add_user_transport_to_pparams(transport_desc);
test_transport_->add_listener_port(global_port);
writer.disable_builtin_transport().add_user_transport_to_pparams(test_transport_);

writer.entity_property_policy(properties).init();

Expand All @@ -1409,7 +1408,6 @@ TEST_P(TransportTCP, tcp_unique_network_flows_init)

participant.sub_topic_name(TEST_TOPIC_NAME);

test_transport_->add_listener_port(global_port);
participant.disable_builtin_transport().add_user_transport_to_pparams(test_transport_);

ASSERT_TRUE(participant.init_participant());
Expand All @@ -1423,8 +1421,9 @@ TEST_P(TransportTCP, tcp_unique_network_flows_init)
participant.get_native_reader(1).get_listening_locators(locators2);

EXPECT_TRUE(locators == locators2);
ASSERT_EQ(locators.size(), 1);
ASSERT_EQ(locators2.size(), 1);
// LocatorList size depends on the number of interfaces. Different address but same port.
ASSERT_GT(locators.size(), 0);
ASSERT_GT(locators2.size(), 0);
auto locator1 = locators.begin();
auto locator2 = locators2.begin();
EXPECT_EQ(IPLocator::getPhysicalPort(*locator1), IPLocator::getPhysicalPort(*locator2));
Expand All @@ -1439,7 +1438,6 @@ TEST_P(TransportTCP, tcp_unique_network_flows_init)
properties.properties().emplace_back("fastdds.unique_network_flows", "");
participant.sub_topic_name(TEST_TOPIC_NAME).sub_property_policy(properties);

test_transport_->add_listener_port(global_port);
participant.disable_builtin_transport().add_user_transport_to_pparams(test_transport_);

ASSERT_TRUE(participant.init_participant());
Expand All @@ -1453,8 +1451,9 @@ TEST_P(TransportTCP, tcp_unique_network_flows_init)
participant.get_native_reader(1).get_listening_locators(locators2);

EXPECT_FALSE(locators == locators2);
ASSERT_EQ(locators.size(), 1);
ASSERT_EQ(locators2.size(), 1);
// LocatorList size depends on the number of interfaces. Different address but same port.
ASSERT_GT(locators.size(), 0);
ASSERT_GT(locators2.size(), 0);
auto locator1 = locators.begin();
auto locator2 = locators2.begin();
EXPECT_EQ(IPLocator::getPhysicalPort(*locator1), IPLocator::getPhysicalPort(*locator2));
Expand Down

0 comments on commit 9d5f9ba

Please sign in to comment.