From dcc705f32c5964ed3c4aadfd53a9faad91c92667 Mon Sep 17 00:00:00 2001 From: cferreiragonz Date: Mon, 29 Apr 2024 14:18:36 +0200 Subject: [PATCH] Refs #20629: Fix Mac test and improve Inconsistent test Signed-off-by: cferreiragonz --- .../unittest/dds/participant/ParticipantTests.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index ce1d31621b..b2e172591f 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -1237,10 +1237,9 @@ TEST(ParticipantTests, ServerParticipantRemoteServerListConfiguration) } /** - * SERVER Participant with initial server with inconsistent GUID prefix. - * Dynamic addition of servers failure. + * Dynamic modification of servers. Replacing previous servers with new ones. */ -TEST(ParticipantTests, ServerParticipantInconsistentRemoteServerListConfiguration) +TEST(ParticipantTests, ServerParticipantReplaceRemoteServerListConfiguration) { Log::ClearConsumers(); MockConsumer* mockConsumer = new MockConsumer("RTPS_QOS_CHECK"); @@ -1257,9 +1256,6 @@ TEST(ParticipantTests, ServerParticipantInconsistentRemoteServerListConfiguratio DomainParticipantQos qos; rtps::LocatorList qos_output; fastrtps::rtps::Locator_t locator; - // Servers of the filename will overwrite the one set by QoS - set_participant_qos(qos, qos_output); - qos_output.clear(); fastrtps::rtps::IPLocator::setIPv4(locator, "84.22.253.128"); locator.port = 8888; qos_output.push_back(locator); @@ -1275,6 +1271,7 @@ TEST(ParticipantTests, ServerParticipantInconsistentRemoteServerListConfiguratio DomainParticipant* participant = DomainParticipantFactory::get_instance()->create_participant( (uint32_t)GET_PID() % 230, qos); ASSERT_NE(nullptr, participant); +#ifndef __APPLE__ fastrtps::rtps::RTPSParticipantAttributes attributes; get_rtps_attributes(participant, attributes); EXPECT_EQ(attributes.builtin.discovery_config.discoveryProtocol, fastrtps::rtps::DiscoveryProtocol::SERVER); @@ -1283,15 +1280,17 @@ TEST(ParticipantTests, ServerParticipantInconsistentRemoteServerListConfiguratio // Modify environment file: fails cause the initial guid prefix did not comply with the schema std::this_thread::sleep_for(std::chrono::milliseconds(100)); file.open(filename); - file << "{\"ROS_DISCOVERY_SERVER\": \"84.22.253.128:8888;192.168.1.133:64863;127.0.0.1:1234\"}"; + file << "{\"ROS_DISCOVERY_SERVER\": \"192.168.1.133:64863\"}"; file.close(); fastrtps::rtps::IPLocator::setIPv4(locator, "192.168.1.133"); locator.port = 64863; + qos_output.clear(); qos_output.push_back(locator); std::this_thread::sleep_for(std::chrono::milliseconds(100)); get_rtps_attributes(participant, attributes); EXPECT_EQ(attributes.builtin.discovery_config.m_DiscoveryServers, qos_output); +#endif // APPLE DomainParticipantQos result_qos = participant->get_qos(); EXPECT_EQ(RETCODE_OK, participant->set_qos(result_qos)); EXPECT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->delete_participant(participant)); @@ -1392,6 +1391,7 @@ TEST(ParticipantTests, ServerParticipantCorrectRemoteServerListConfiguration) DomainParticipant* participant = DomainParticipantFactory::get_instance()->create_participant( (uint32_t)GET_PID() % 230, qos); ASSERT_NE(nullptr, participant); +#ifndef __APPLE__ fastrtps::rtps::RTPSParticipantAttributes attributes; get_rtps_attributes(participant, attributes); EXPECT_EQ(attributes.builtin.discovery_config.m_DiscoveryServers, output); @@ -1399,7 +1399,6 @@ TEST(ParticipantTests, ServerParticipantCorrectRemoteServerListConfiguration) // Even though the server added previously through the environment file is being pinged, it is not really being // checked because it is not included in the attributes. DomainParticipantQos result_qos; -#ifndef __APPLE__ std::this_thread::sleep_for(std::chrono::milliseconds(100)); file.open(filename); file << "{\"ROS_DISCOVERY_SERVER\": \"172.17.0.5:4321;;192.168.1.133:64863\"}";