Skip to content

Commit

Permalink
Refs #12529: fix test in MacOS
Browse files Browse the repository at this point in the history
Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
  • Loading branch information
JLBuenoLopez committed Oct 20, 2021
1 parent 4af6f77 commit 4f6ca2a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/unittest/dds/participant/ParticipantTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,13 +663,15 @@ TEST(ParticipantTests, RemoteServersListConfiguration)
server.metatrafficUnicastLocatorList.push_back(locator);
get_server_client_default_guidPrefix(1, server.guidPrefix);
output.push_back(server);
#ifndef __APPLE__
std::this_thread::sleep_for(std::chrono::milliseconds(1100));
file.open(filename);
file << "{\"ROS_DISCOVERY_SERVER\": \"84.22.253.128:8888;192.168.1.133:64863;localhost:1234\"}";
file.close();
std::this_thread::sleep_for(std::chrono::milliseconds(1100));
get_rtps_attributes(participant, attributes);
EXPECT_EQ(attributes.builtin.discovery_config.m_DiscoveryServers, output);
#endif // APPLE
result_qos = participant->get_qos();
EXPECT_EQ(ReturnCode_t::RETCODE_OK, participant->set_qos(result_qos));
EXPECT_EQ(ReturnCode_t::RETCODE_OK, DomainParticipantFactory::get_instance()->delete_participant(participant));
Expand Down Expand Up @@ -748,7 +750,9 @@ TEST(ParticipantTests, RemoteServersListConfiguration)
get_rtps_attributes(participant, attributes);
EXPECT_EQ(attributes.builtin.discovery_config.m_DiscoveryServers, qos_output);
// Capture log warning
#ifndef __APPLE__
helper_wait_for_at_least_entries(mockConsumer, 1);
#endif // APPLE
result_qos = participant->get_qos();
EXPECT_EQ(ReturnCode_t::RETCODE_OK, participant->set_qos(result_qos));
EXPECT_EQ(ReturnCode_t::RETCODE_OK, DomainParticipantFactory::get_instance()->delete_participant(participant));
Expand Down Expand Up @@ -789,13 +793,15 @@ TEST(ParticipantTests, RemoteServersListConfiguration)
participant = DomainParticipantFactory::get_instance()->create_participant(0, qos);
ASSERT_NE(nullptr, participant);
// Try adding a new remote server
#ifndef __APPLE__
std::this_thread::sleep_for(std::chrono::milliseconds(1100));
file.open(filename);
file << "{\"ROS_DISCOVERY_SERVER\": \"172.17.0.5:4321;192.168.1.133:64863\"}";
file.close();
std::this_thread::sleep_for(std::chrono::milliseconds(1100));
get_rtps_attributes(participant, attributes);
EXPECT_EQ(attributes.builtin.discovery_config.m_DiscoveryServers, output);
#endif // APPLE
result_qos = participant->get_qos();
EXPECT_EQ(ReturnCode_t::RETCODE_OK, participant->set_qos(result_qos));
EXPECT_EQ(ReturnCode_t::RETCODE_OK, DomainParticipantFactory::get_instance()->delete_participant(participant));
Expand All @@ -822,6 +828,7 @@ TEST(ParticipantTests, RemoteServersListConfiguration)
// Add new server through environment file
// 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.
#ifndef __APPLE__
std::this_thread::sleep_for(std::chrono::milliseconds(1100));
file.open(filename);
file << "{\"ROS_DISCOVERY_SERVER\": \"172.17.0.5:4321;;192.168.1.133:64863\"}";
Expand Down Expand Up @@ -871,6 +878,7 @@ TEST(ParticipantTests, RemoteServersListConfiguration)
output.push_back(server);
get_rtps_attributes(participant, attributes);
EXPECT_EQ(attributes.builtin.discovery_config.m_DiscoveryServers, output);
#endif // APPLE
result_qos = participant->get_qos();
EXPECT_EQ(ReturnCode_t::RETCODE_OK, participant->set_qos(result_qos));
EXPECT_EQ(ReturnCode_t::RETCODE_OK, DomainParticipantFactory::get_instance()->delete_participant(participant));
Expand Down

0 comments on commit 4f6ca2a

Please sign in to comment.