From 242f4b71182e48b505c523b34b441b16f1c3ae8e Mon Sep 17 00:00:00 2001 From: jparisu Date: Thu, 28 Oct 2021 07:58:54 +0200 Subject: [PATCH] Refs #12522: Add client reconnect test Signed-off-by: jparisu --- src/main.cpp | 12 ---- test/CMakeLists.txt | 35 +++++----- ...est_45_trivial_client_reconnect_client.xml | 60 ++++++++++++++++ ...est_45_trivial_client_reconnect_server.xml | 38 +++++++++++ ...5_trivial_client_reconnect_client.snapshot | 29 ++++++++ test/configuration/tests_params.json | 68 +++++++++++++++++++ 6 files changed, 213 insertions(+), 29 deletions(-) create mode 100644 test/configuration/test_cases/test_45_trivial_client_reconnect_client.xml create mode 100644 test/configuration/test_cases/test_45_trivial_client_reconnect_server.xml create mode 100644 test/configuration/test_solutions/test_45_trivial_client_reconnect_client.snapshot diff --git a/src/main.cpp b/src/main.cpp index 352c4adf..bdea8c46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,17 +36,6 @@ int main( int argc, char* argv[]) { -<<<<<<< HEAD - - // Initialize loging -#if defined LOG_LEVEL_INFO - Log::SetVerbosity(Log::Kind::Info); -#elif defined LOG_LEVEL_WARN - Log::SetVerbosity(Log::Kind::Warning); -#elif defined LOG_LEVEL_ERROR - Log::SetVerbosity(Log::Kind::Error); -#endif // if defined LOG_LEVEL_INFO -======= // Clear all the consumers. Log::ClearConsumers(); @@ -60,7 +49,6 @@ int main( #else Log::SetVerbosity(Log::Kind::Error); #endif ->>>>>>> 2e3b557... Revert "Revert "Reconnection tests [12522]"" #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 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9b63246f..9e0f2ea6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -119,12 +119,13 @@ list(APPEND TEST_LIST test_42_server_reconnect_with_clients test_43_complex_reconnect test_44_fast_discovery_server_tool_reconnect + test_45_trivial_client_reconnect ) # FASTDDS_ENVIRONMENT_FILE was introduced in Fast DDS v2.4.0 if(fastrtps_VERSION VERSION_GREATER_EQUAL "2.4.0") list(APPEND TEST_LIST - test_39_environment_modification + test_50_environment_modification ) endif() @@ -133,22 +134,22 @@ set(TEST_CASE_LIST) foreach(TEST IN LISTS TEST_LIST) - unset(TEST_NAME) - set(TEST_NAME "discovery_server_test.${TEST}.SHM_ON") - list(APPEND TEST_CASE_LIST ${TEST_NAME}) - # Test with shared memory - add_test(NAME ${TEST_NAME} - COMMAND ${PYTHON_EXECUTABLE} ${RUN_TEST} - -e $ - -p ${TESTS_PARAMS} - -f $<$:$> - -t ${TEST} - -s true - -i false) # Remove this argument to execute test with and without intraprocess - # --force-remove # Add this argument to erase every file generated during test execution - set_tests_properties(${TEST_NAME} PROPERTIES - REQUIRED_FILES ${RUN_TEST} - REQUIRED_FILES ${TESTS_PARAMS}) + # unset(TEST_NAME) + # set(TEST_NAME "discovery_server_test.${TEST}.SHM_ON") + # list(APPEND TEST_CASE_LIST ${TEST_NAME}) + # # Test with shared memory + # add_test(NAME ${TEST_NAME} + # COMMAND ${PYTHON_EXECUTABLE} ${RUN_TEST} + # -e $ + # -p ${TESTS_PARAMS} + # -f $<$:$> + # -t ${TEST} + # -s true + # -i false) # Remove this argument to execute test with and without intraprocess + # # --force-remove # Add this argument to erase every file generated during test execution + # set_tests_properties(${TEST_NAME} PROPERTIES + # REQUIRED_FILES ${RUN_TEST} + # REQUIRED_FILES ${TESTS_PARAMS}) unset(TEST_NAME) set(TEST_NAME "discovery_server_test.${TEST}.SHM_OFF") diff --git a/test/configuration/test_cases/test_45_trivial_client_reconnect_client.xml b/test/configuration/test_cases/test_45_trivial_client_reconnect_client.xml new file mode 100644 index 00000000..ce05047a --- /dev/null +++ b/test/configuration/test_cases/test_45_trivial_client_reconnect_client.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + Knows server B + Do not know server B + Knows server B + + + + + + 63.6c.69.65.6e.74.31.5f.73.31.5f.5f + + + CLIENT + + + + + +
127.0.0.1
+ 45811 +
+
+
+
+
+ + 0 + + DURATION_INFINITY + DURATION_INFINITY +
+
+
+
+ + + topic_1 + sample_type_1 + + + + + + + + + + + +
+
diff --git a/test/configuration/test_cases/test_45_trivial_client_reconnect_server.xml b/test/configuration/test_cases/test_45_trivial_client_reconnect_server.xml new file mode 100644 index 00000000..82b71157 --- /dev/null +++ b/test/configuration/test_cases/test_45_trivial_client_reconnect_server.xml @@ -0,0 +1,38 @@ + + + + + + + + + Do know the client + + + + + + 44.49.53.43.53.45.52.56.45.52.5F.31 + + + SERVER + + 0 + + DURATION_INFINITY + DURATION_INFINITY + + + + +
127.0.0.1
+ 45811 +
+
+
+
+
+
+ +
+
diff --git a/test/configuration/test_solutions/test_45_trivial_client_reconnect_client.snapshot b/test/configuration/test_solutions/test_45_trivial_client_reconnect_client.snapshot new file mode 100644 index 00000000..190c9f1d --- /dev/null +++ b/test/configuration/test_solutions/test_45_trivial_client_reconnect_client.snapshot @@ -0,0 +1,29 @@ + + + + Knows server B + + + + + + + + + Do not know server B + + + + + + + + Knows server B + + + + + + + + diff --git a/test/configuration/tests_params.json b/test/configuration/tests_params.json index 9a358d1d..cee19c01 100644 --- a/test/configuration/tests_params.json +++ b/test/configuration/tests_params.json @@ -2057,6 +2057,74 @@ } }, + + "test_45_trivial_client_reconnect": + { + "description": [ + "Client connects with Server. Server leaves. Server turns back with same configuration." + ], + + "processes": + { + "client": + { + "xml_config_file": "/test_cases/test_45_trivial_client_reconnect_client.xml", + "validation": + { + "exit_code_validation": + { + "expected_exit_code": 0 + }, + "stderr_validation": + { + "err_expected_lines": 0 + }, + "count_lines_validation": + { + "file_path": "/test_solutions/test_45_trivial_client_reconnect_client.snapshot" + }, + "ground_truth_validation": + { + "file_path": "/test_solutions/test_45_trivial_client_reconnect_client.snapshot" + } + } + }, + + "server_0": + { + "xml_config_file": "/test_cases/test_45_trivial_client_reconnect_server.xml", + "validation": + { + "exit_code_validation": + { + "expected_exit_code": 0 + }, + "stderr_validation": + { + "err_expected_lines": 0 + } + } + }, + + "server_1": + { + "creation_time": 6, + "xml_config_file": "/test_cases/test_45_trivial_client_reconnect_server.xml", + "validation": + { + "exit_code_validation": + { + "expected_exit_code": 0 + }, + "stderr_validation": + { + "err_expected_lines": 0 + } + } + } + } + }, + "test_50_environment_modification": { "description": [