Skip to content

Commit

Permalink
Reconnection tests (#45)
Browse files Browse the repository at this point in the history
* Revert "Revert "Reconnection tests [12522]""

Signed-off-by: RaulSanchez <[email protected]>

* Refs #12522: Add test for tool reconnection

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Add client reconnect test

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Uncomment SHM_ON

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Set test 41 time longer for jenkins

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Set test 42 time longer for jenkins

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Set test 43 time longer for jenkins

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Apply suggestions

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Change 39 name number to 60

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Extend 39 test time

Signed-off-by: jparisu <[email protected]>

* Refs #12522: Delayed third snapshot and all steps after that one for test 50

Signed-off-by: Javier Santiago <[email protected]>

Co-authored-by: jparisu <[email protected]>
Co-authored-by: Javier Santiago <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2021
1 parent dfa551b commit 798f165
Show file tree
Hide file tree
Showing 36 changed files with 2,386 additions and 30 deletions.
14 changes: 3 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,9 @@ endif()
# Logging
###############################################################################

if(NOT DEFINED LOG_LEVEL_INFO)
set(LOG_LEVEL_INFO OFF)
endif()

if(NOT DEFINED LOG_LEVEL_WARN)
set(LOG_LEVEL_WARN OFF)
endif()

if(NOT DEFINED LOG_LEVEL_ERROR)
SET(LOG_LEVEL_ERROR ON)
endif()
option(LOG_LEVEL_INFO OFF)
option(LOG_LEVEL_WARN OFF)
option(LOG_LEVEL_ERROR OFF)

add_definitions(-DLOG_LEVEL_INFO=$<STREQUAL:$<UPPER_CASE:${LOG_LEVEL_INFO}>,ON>)
add_definitions(-DLOG_LEVEL_WARN=$<STREQUAL:$<UPPER_CASE:${LOG_LEVEL_WARN}>,ON>)
Expand Down
8 changes: 4 additions & 4 deletions src/DSLog.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
#ifndef _EPROSIMA_IS_LOG_H_
#define _EPROSIMA_IS_LOG_H_

#if defined LOG_LEVEL_INFO && LOG_LEVEL_INFO
#if defined LOG_LEVEL_INFO && LOG_LEVEL_INFO
#define __INTERNALDEBUG
#define __DEBUG
#define __DEBUG
#undef LOG_NO_INFO
#undef LOG_NO_WARN
#undef LOG_NO_ERROR
#elif defined LOG_LEVEL_WARN && LOG_LEVEL_WARN
#elif defined LOG_LEVEL_WARN && LOG_LEVEL_WARN
#define LOG_NO_INFO
#undef LOG_NO_WARN
#undef LOG_NO_ERROR
#elif defined LOG_LEVEL_ERROR && LOG_LEVEL_ERROR
#elif defined LOG_LEVEL_ERROR && LOG_LEVEL_ERROR
#define LOG_NO_INFO
#define LOG_NO_WARN
#undef LOG_NO_ERROR
Expand Down
7 changes: 2 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "log/DSLog.h"
#include "version/config.h"

#if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 1
#if FASTRTPS_VERSION_MAJOR > 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR >= 1)
#include <fastdds/dds/log/StdoutErrConsumer.hpp>
#endif // if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 1
#include <fastrtps/xmlparser/XMLProfileManager.h>
Expand Down Expand Up @@ -48,10 +48,7 @@ int main(
Log::SetVerbosity(Log::Kind::Error);
#else
Log::SetVerbosity(Log::Kind::Error);
#endif // if defined LOG_LEVEL_INFO


// Log::SetCategoryFilter(std::regex("(DISCOVERY_SERVER)"));
#endif // if LOG_LEVEL_INFO

#if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 1
// Create a StdoutErrConsumer consumer that logs entries to stderr only when the Log::Kind is equal to WARNING
Expand Down
13 changes: 11 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ list(APPEND TEST_LIST
test_34_connect_locally_with_remote_server

test_38_self_connection

test_39_trivial_reconnect
test_40_trivial_server_reconnect
test_41_reconnect_with_clients
test_42_server_reconnect_with_clients
test_43_complex_reconnect
test_44_fast_discovery_server_tool_reconnect
test_45_trivial_client_reconnect

test_60_disconnection

test_99_tcp
Expand All @@ -105,13 +114,13 @@ if(fastrtps_VERSION VERSION_GREATER_EQUAL "2.3.0")
)
endif()

# Adding remote servers while running was introduced in Fast DDS v2.4.0
# Adding DNS and Environment modification while running was introduced in Fast DDS v2.4.0
if(fastrtps_VERSION VERSION_GREATER_EQUAL "2.4.0")
list(APPEND TEST_LIST
test_36_dns_environment_variable_setup
test_37_dns_fast_discovery_server_tool

test_39_environment_modification
test_50_environment_modification
)
endif()

Expand Down
40 changes: 40 additions & 0 deletions test/configuration/test_cases/test_39_trivial_reconnect_A.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<servers>
<server name="server" profile_name="UDP server A" />
</servers>

<snapshots file="./test_39_trivial_reconnect_A.snapshot~">
<snapshot time="2">Knows server B</snapshot>
<snapshot time="7">Do not know server B</snapshot>
<snapshot time="11">Knows server B</snapshot>
</snapshots>

<profiles>
<participant profile_name="UDP server A">
<rtps>
<prefix>44.49.53.43.53.45.52.56.45.52.5F.31</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>39811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

</profiles>
</DS>
52 changes: 52 additions & 0 deletions test/configuration/test_cases/test_39_trivial_reconnect_B.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<servers>
<server name="server" profile_name="UDP server B" />
</servers>

<snapshots file="./test_39_trivial_reconnect_B.snapshot~">
<snapshot time="2">Knows A</snapshot>
<snapshot time="5">Do not know A</snapshot>
</snapshots>

<profiles>

<participant profile_name="UDP server B">
<rtps>
<prefix>44.49.53.43.53.45.52.56.45.52.5F.32</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
<discoveryServersList>
<RemoteServer prefix="44.49.53.43.53.45.52.56.45.52.5F.31">
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>39811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</RemoteServer>
</discoveryServersList>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>39812</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<servers>
<server name="server" profile_name="UDP server A" />
</servers>

<snapshots file="./test_40_trivial_server_reconnect_A.snapshot~">
<snapshot time="2">Knows server B</snapshot>
<snapshot time="7">Do not know server B</snapshot>
<snapshot time="11">Knows server B</snapshot>
</snapshots>

<profiles>
<participant profile_name="UDP server A">
<rtps>
<prefix>44.49.53.43.53.45.52.56.45.52.5F.31</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
<discoveryServersList>
<RemoteServer prefix="44.49.53.43.53.45.52.56.45.52.5F.32">
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>40812</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</RemoteServer>
</discoveryServersList>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>40811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<servers>
<server name="server" profile_name="UDP server B" />
</servers>

<snapshots file="./test_40_trivial_server_reconnect_B.snapshot~">
<snapshot time="3">Knows A</snapshot>
<snapshot time="5">Do not know A</snapshot>
</snapshots>

<profiles>

<participant profile_name="UDP server B">
<rtps>
<prefix>44.49.53.43.53.45.52.56.45.52.5F.32</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>40812</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

</profiles>
</DS>
89 changes: 89 additions & 0 deletions test/configuration/test_cases/test_41_reconnect_with_clients_A.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<servers>
<server name="server" profile_name="UDP server A" />
</servers>

<clients>
<client name="client1" profile_name="UDP_client1_serverA">
<publisher topic="topic1"/>
</client>
</clients>

<snapshots file="./test_41_reconnect_with_clients_A.snapshot~">
<snapshot time="2">Knows server B, client A and client B</snapshot>
<snapshot time="12">Do not know server B</snapshot>
<snapshot time="18">Knows server B, client A and client B</snapshot>
</snapshots>

<profiles>

<participant profile_name="UDP_client1_serverA" >
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<RemoteServer prefix="44.49.53.43.53.45.52.56.45.52.5F.31">
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>41811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</RemoteServer>
</discoveryServersList>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
</builtin>
</rtps>
</participant>

<participant profile_name="UDP server A">
<rtps>
<prefix>44.49.53.43.53.45.52.56.45.52.5F.31</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
<initialAnnouncements>
<count>0</count>
</initialAnnouncements>
<leaseAnnouncement>DURATION_INFINITY</leaseAnnouncement>
<leaseDuration>DURATION_INFINITY</leaseDuration>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>41811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

<topic profile_name="topic1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>

</profiles>
</DS>
Loading

0 comments on commit 798f165

Please sign in to comment.