Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA. ## Improvement - \#207 - Add more unittest for config set/get - \#208 - optimize unittest to support run single test more easily ## Task Loading core/src/server/Config.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -795,11 +795,16 @@ Config::GetConfigStr(const std::string& parent_key, const std::string& child_key } std::string Config::GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim) { Config::GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim, const std::string& default_value) { std::string value; if (!GetConfigValueInMem(parent_key, child_key, value).ok()) { std::vector<std::string> sequence = GetConfigNode(parent_key).GetSequence(child_key); if (sequence.empty()) { value = default_value; } else { server::StringHelpFunctions::MergeStringWithDelimeter(sequence, delim, value); } SetConfigValueInMem(parent_key, child_key, value); } return value; Loading Loading @@ -1028,8 +1033,9 @@ Config::GetResourceConfigMode(std::string& value) { Status Config::GetResourceConfigSearchResources(std::vector<std::string>& value) { std::string str = GetConfigSequenceStr(CONFIG_RESOURCE, CONFIG_RESOURCE_SEARCH_RESOURCES, CONFIG_RESOURCE_SEARCH_RESOURCES_DELIMITER); std::string str = GetConfigSequenceStr(CONFIG_RESOURCE, CONFIG_RESOURCE_SEARCH_RESOURCES, CONFIG_RESOURCE_SEARCH_RESOURCES_DELIMITER, CONFIG_RESOURCE_SEARCH_RESOURCES_DEFAULT); server::StringHelpFunctions::SplitStringByDelimeter(str, CONFIG_RESOURCE_SEARCH_RESOURCES_DELIMITER, value); return CheckResourceConfigSearchResources(value); } Loading core/src/server/Config.h +2 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,8 @@ class Config { std::string GetConfigStr(const std::string& parent_key, const std::string& child_key, const std::string& default_value = ""); std::string GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim); GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim = ",", const std::string& default_value = ""); public: /* server config */ Loading core/unittest/db/CMakeLists.txt +10 −2 Original line number Diff line number Diff line Loading @@ -17,8 +17,16 @@ # under the License. #------------------------------------------------------------------------------- aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} test_files) set(test_files ${CMAKE_CURRENT_SOURCE_DIR}/test_db.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_db_mysql.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_engine.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_mem.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_meta.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_meta_mysql.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_misc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_search.cpp ${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp) cuda_add_executable(test_db ${common_files} Loading core/unittest/db/utils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -60,8 +60,8 @@ static const char " port: 8080 # port prometheus used to fetch metrics\n" "\n" "cache_config:\n" " cpu_mem_capacity: 16 # GB, CPU memory used for cache\n" " cpu_mem_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n" " cpu_cache_capacity: 16 # GB, CPU memory used for cache\n" " cpu_cache_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n" " cache_insert_data: false # whether load inserted data into cache\n" "\n" "engine_config:\n" Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA. ## Improvement - \#207 - Add more unittest for config set/get - \#208 - optimize unittest to support run single test more easily ## Task Loading
core/src/server/Config.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -795,11 +795,16 @@ Config::GetConfigStr(const std::string& parent_key, const std::string& child_key } std::string Config::GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim) { Config::GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim, const std::string& default_value) { std::string value; if (!GetConfigValueInMem(parent_key, child_key, value).ok()) { std::vector<std::string> sequence = GetConfigNode(parent_key).GetSequence(child_key); if (sequence.empty()) { value = default_value; } else { server::StringHelpFunctions::MergeStringWithDelimeter(sequence, delim, value); } SetConfigValueInMem(parent_key, child_key, value); } return value; Loading Loading @@ -1028,8 +1033,9 @@ Config::GetResourceConfigMode(std::string& value) { Status Config::GetResourceConfigSearchResources(std::vector<std::string>& value) { std::string str = GetConfigSequenceStr(CONFIG_RESOURCE, CONFIG_RESOURCE_SEARCH_RESOURCES, CONFIG_RESOURCE_SEARCH_RESOURCES_DELIMITER); std::string str = GetConfigSequenceStr(CONFIG_RESOURCE, CONFIG_RESOURCE_SEARCH_RESOURCES, CONFIG_RESOURCE_SEARCH_RESOURCES_DELIMITER, CONFIG_RESOURCE_SEARCH_RESOURCES_DEFAULT); server::StringHelpFunctions::SplitStringByDelimeter(str, CONFIG_RESOURCE_SEARCH_RESOURCES_DELIMITER, value); return CheckResourceConfigSearchResources(value); } Loading
core/src/server/Config.h +2 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,8 @@ class Config { std::string GetConfigStr(const std::string& parent_key, const std::string& child_key, const std::string& default_value = ""); std::string GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim); GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim = ",", const std::string& default_value = ""); public: /* server config */ Loading
core/unittest/db/CMakeLists.txt +10 −2 Original line number Diff line number Diff line Loading @@ -17,8 +17,16 @@ # under the License. #------------------------------------------------------------------------------- aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} test_files) set(test_files ${CMAKE_CURRENT_SOURCE_DIR}/test_db.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_db_mysql.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_engine.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_mem.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_meta.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_meta_mysql.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_misc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_search.cpp ${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp) cuda_add_executable(test_db ${common_files} Loading
core/unittest/db/utils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -60,8 +60,8 @@ static const char " port: 8080 # port prometheus used to fetch metrics\n" "\n" "cache_config:\n" " cpu_mem_capacity: 16 # GB, CPU memory used for cache\n" " cpu_mem_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n" " cpu_cache_capacity: 16 # GB, CPU memory used for cache\n" " cpu_cache_threshold: 0.85 # percentage of data kept when cache cleanup triggered\n" " cache_insert_data: false # whether load inserted data into cache\n" "\n" "engine_config:\n" Loading