Skip to content

Commit c2cfb0f

Browse files
committed
Bp #107: TCP tests
Signed-off-by: cferreiragonz <[email protected]>
1 parent 26d6a82 commit c2cfb0f

File tree

4 files changed

+186
-0
lines changed

4 files changed

+186
-0
lines changed

test/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ list(APPEND TEST_LIST
9696

9797
test_60_disconnection
9898
test_61_superclient_environment_variable
99+
100+
test_94_tcpv4_custom_guid_transform_locators
101+
test_95_tcpv4_cli
102+
test_96_tcpv6_cli
103+
test_97_tcpv4_env_var
104+
test_98_tcpv6_env_var
99105
test_99_tcp
100106
)
101107

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
3+
4+
<!-- When a DS with a custom GUID (-i param of CLI) listens on any (0.0.0.0) and the clients use
5+
localhost (127.0.0.1) to connect to the server, the GUID comparison is insufficient to
6+
correctly transform the server's locator when it is received by the client. If a local interface
7+
is received, a new entry to the channel_resources_ map will be created to redirect all TCP
8+
traffic in the same machine through the same channel.
9+
This test is a regression from #22006.-->
10+
11+
<clients>
12+
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
13+
<subscriber topic="topic1"/>
14+
</client>
15+
<client name="client2" profile_name="TCPv4_client_2" listening_port="0">
16+
<publisher topic="topic1"/>
17+
</client>
18+
</clients>
19+
20+
<snapshots file="./test_94_tcpv4_custom_guid_transform_locators.snapshot">
21+
<snapshot time="5">Knows all</snapshot>
22+
</snapshots>
23+
24+
<profiles>
25+
26+
<transport_descriptors>
27+
<transport_descriptor>
28+
<transport_id>transport_client_1</transport_id>
29+
<type>TCPv4</type>
30+
<listening_ports>
31+
<port>0</port>
32+
</listening_ports>
33+
</transport_descriptor>
34+
<transport_descriptor>
35+
<transport_id>transport_client_2</transport_id>
36+
<type>TCPv4</type>
37+
<listening_ports>
38+
<port>0</port>
39+
</listening_ports>
40+
</transport_descriptor>
41+
</transport_descriptors>
42+
43+
<participant profile_name="TCPv4_client_1" is_default_profile="true">
44+
<rtps>
45+
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
46+
<useBuiltinTransports>false</useBuiltinTransports>
47+
<userTransports>
48+
<transport_id>transport_client_1</transport_id>
49+
</userTransports>
50+
<builtin>
51+
<discovery_config>
52+
<discoveryProtocol>CLIENT</discoveryProtocol>
53+
<discoveryServersList>
54+
<locator>
55+
<tcpv4>
56+
<address>127.0.0.1</address>
57+
<physical_port>42200</physical_port>
58+
<port>42200</port>
59+
</tcpv4>
60+
</locator>
61+
</discoveryServersList>
62+
</discovery_config>
63+
</builtin>
64+
</rtps>
65+
</participant>
66+
67+
<participant profile_name="TCPv4_client_2" is_default_profile="true">
68+
<rtps>
69+
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
70+
<useBuiltinTransports>false</useBuiltinTransports>
71+
<userTransports>
72+
<transport_id>transport_client_2</transport_id>
73+
</userTransports>
74+
<builtin>
75+
<discovery_config>
76+
<discoveryProtocol>CLIENT</discoveryProtocol>
77+
<discoveryServersList>
78+
<locator>
79+
<tcpv4>
80+
<address>127.0.0.1</address>
81+
<physical_port>42200</physical_port>
82+
<port>42200</port>
83+
</tcpv4>
84+
</locator>
85+
</discoveryServersList>
86+
</discovery_config>
87+
</builtin>
88+
</rtps>
89+
</participant>
90+
91+
<topic profile_name="topic1">
92+
<name>topic_1</name>
93+
<dataType>HelloWorld</dataType>
94+
</topic>
95+
96+
</profiles>
97+
98+
</DS>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<DS_Snapshots xmlns="http://www.eprosima.com/XMLSchemas/ds-snapshot">
3+
<DS_Snapshot timestamp="1701424362042" process_time="5000" last_pdp_callback_time="620" last_edp_callback_time="1067" someone="true">
4+
<description>Knows all</description>
5+
<ptdb guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
6+
<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"/>
7+
<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">
8+
<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"/>
9+
</ptdi>
10+
<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">
11+
<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"/>
12+
</ptdi>
13+
</ptdb>
14+
<ptdb guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
15+
<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"/>
16+
<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">
17+
<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"/>
18+
</ptdi>
19+
<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">
20+
<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"/>
21+
</ptdi>
22+
</ptdb>
23+
</DS_Snapshot>
24+
</DS_Snapshots>

test/configuration/tests_params.json

+58
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,64 @@
22712271
}
22722272
},
22732273

2274+
"test_94_tcpv4_custom_guid_transform_locators":
2275+
{
2276+
"description": [
2277+
"Test that a TCP discovery server with a custom GUID (-i CLI param) and listening on any (0.0.0.0)\n",
2278+
"is able to communicate with a client that connects to localhost (127.0.0.1).\n",
2279+
"This test is a regression from #22006"
2280+
],
2281+
2282+
"processes":
2283+
{
2284+
"main":
2285+
{
2286+
"xml_config_file": "<CONFIG_RELATIVE_PATH>/test_cases/test_94_tcpv4_custom_guid_transform_locators.xml",
2287+
"validation":
2288+
{
2289+
"exit_code_validation":
2290+
{
2291+
"expected_exit_code": 0
2292+
},
2293+
"stderr_validation":
2294+
{
2295+
"err_expected_lines": 0
2296+
},
2297+
"count_lines_validation":
2298+
{
2299+
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
2300+
},
2301+
"ground_truth_validation":
2302+
{
2303+
"guidless": false,
2304+
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
2305+
}
2306+
}
2307+
},
2308+
"fastddstool":
2309+
{
2310+
"kill_time": 6,
2311+
"tool_config":
2312+
{
2313+
"id" : 0,
2314+
"tcp_address": "0.0.0.0",
2315+
"tcp_port": 42200
2316+
},
2317+
"validation":
2318+
{
2319+
"exit_code_validation":
2320+
{
2321+
"expected_exit_code": 0
2322+
},
2323+
"stderr_validation":
2324+
{
2325+
"err_expected_lines": 0
2326+
}
2327+
}
2328+
}
2329+
}
2330+
},
2331+
22742332
"test_95_tcpv4_cli":
22752333
{
22762334
"description": [

0 commit comments

Comments
 (0)