Skip to content

Commit

Permalink
Refs #22056: TCP-DS host_id test
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Nov 5, 2024
1 parent c8c61dd commit 1deed68
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ list(APPEND TEST_LIST
test_60_disconnection
test_61_superclient_environment_variable

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

<!-- When a DS with a custom GUID (-i param of CLI) listens on any (0.0.0.0) and the clients use
localhost (127.0.0.1) to connect to the server, the GUID comparison is insufficient to
correctly transform the server's locator when it is received by the client. A more reliable
method is required to check if the server's locator is from the same host as the client.
This test is a regression from #22006.-->

<clients>
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
<subscriber topic="topic1"/>
</client>
<client name="client2" profile_name="TCPv4_client_2" listening_port="0">
<publisher topic="topic1"/>
</client>
</clients>

<snapshots file="./test_94_tcpv4_custom_guid_transform_locators.snapshot">
<snapshot time="5">Knows all</snapshot>
</snapshots>

<profiles>

<transport_descriptors>
<transport_descriptor>
<transport_id>transport_client_1</transport_id>
<type>TCPv4</type>
<listening_ports>
<port>0</port>
</listening_ports>
</transport_descriptor>
<transport_descriptor>
<transport_id>transport_client_2</transport_id>
<type>TCPv4</type>
<listening_ports>
<port>0</port>
</listening_ports>
</transport_descriptor>
</transport_descriptors>

<participant profile_name="TCPv4_client_1" is_default_profile="true">
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>transport_client_1</transport_id>
</userTransports>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<locator>
<tcpv4>
<address>127.0.0.1</address>
<physical_port>42200</physical_port>
<port>42200</port>
</tcpv4>
</locator>
</discoveryServersList>
</discovery_config>
</builtin>
</rtps>
</participant>

<participant profile_name="TCPv4_client_2" is_default_profile="true">
<rtps>
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>transport_client_2</transport_id>
</userTransports>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<locator>
<tcpv4>
<address>127.0.0.1</address>
<physical_port>42200</physical_port>
<port>42200</port>
</tcpv4>
</locator>
</discoveryServersList>
</discovery_config>
</builtin>
</rtps>
</participant>

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

</profiles>

</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<DS_Snapshots xmlns="http://www.eprosima.com/XMLSchemas/ds-snapshot">
<DS_Snapshot timestamp="1701424362042" process_time="5000" last_pdp_callback_time="620" last_edp_callback_time="1067" someone="true">
<description>Knows all</description>
<ptdb guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
<ptdi guid_prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41" guid_entity="0.0.1.c1" server="false" alive="true" name="eProsima Default Server number 0" discovered_timestamp="339"/>
<ptdi guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="" discovered_timestamp="125">
<subscriber type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.4" discovered_timestamp="125"/>
</ptdi>
<ptdi guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="client2" discovered_timestamp="620">
<publisher type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.3" discovered_timestamp="1067"/>
</ptdi>
</ptdb>
<ptdb guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
<ptdi guid_prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41" guid_entity="0.0.1.c1" server="false" alive="true" name="eProsima Default Server number 0" discovered_timestamp="489"/>
<ptdi guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="client1" discovered_timestamp="615">
<subscriber type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.4" discovered_timestamp="1067"/>
</ptdi>
<ptdi guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="" discovered_timestamp="233">
<publisher type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.3" discovered_timestamp="233"/>
</ptdi>
</ptdb>
</DS_Snapshot>
</DS_Snapshots>
58 changes: 58 additions & 0 deletions test/configuration/tests_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -2547,6 +2547,64 @@
}
},

"test_94_tcpv4_custom_guid_transform_locators":
{
"description": [
"Test that a TCP discovery server with a custom GUID (-i CLI param) and listening on any (0.0.0.0)\n",
"is able to communicate with a client that connects to localhost (127.0.0.1).\n",
"This test is a regression from #22006"
],

"processes":
{
"main":
{
"xml_config_file": "<CONFIG_RELATIVE_PATH>/test_cases/test_94_tcpv4_custom_guid_transform_locators.xml",
"validation":
{
"exit_code_validation":
{
"expected_exit_code": 0
},
"stderr_validation":
{
"err_expected_lines": 0
},
"count_lines_validation":
{
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
},
"ground_truth_validation":
{
"guidless": false,
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
}
}
},
"fastddstool":
{
"kill_time": 6,
"tool_config":
{
"id" : 0,
"tcp_address": "0.0.0.0",
"tcp_port": 42200
},
"validation":
{
"exit_code_validation":
{
"expected_exit_code": 0
},
"stderr_validation":
{
"err_expected_lines": 0
}
}
}
}
},

"test_95_tcpv4_cli":
{
"description": [
Expand Down

0 comments on commit 1deed68

Please sign in to comment.