diff --git a/cpp/src/utils/LogUtil.cpp b/cpp/src/utils/LogUtil.cpp index ec6f078500..98a9596da8 100644 --- a/cpp/src/utils/LogUtil.cpp +++ b/cpp/src/utils/LogUtil.cpp @@ -27,7 +27,7 @@ static int fatal_idx = 0; } // TODO(yzb) : change the easylogging library to get the log level from parameter rather than filename -void rolloutHandler(const char *filename, std::size_t size) { +void RolloutHandler(const char *filename, std::size_t size) { char *dirc = strdup(filename); char *basec = strdup(filename); char *dir = dirname(dirc); @@ -112,7 +112,7 @@ int32_t InitLog(const std::string &log_config_file) { el::Loggers::reconfigureAllLoggers(conf); el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck); - el::Helpers::installPreRollOutCallback(rolloutHandler); + el::Helpers::installPreRollOutCallback(RolloutHandler); return 0; } diff --git a/cpp/src/utils/LogUtil.h b/cpp/src/utils/LogUtil.h index d6c9eff252..7c8d936a6d 100644 --- a/cpp/src/utils/LogUtil.h +++ b/cpp/src/utils/LogUtil.h @@ -16,6 +16,7 @@ inline std::string GetFileName(std::string filename) { int pos = filename.find_last_of('/'); return filename.substr(pos + 1); } +void RolloutHandler(const char *filename, std::size_t size); #define SHOW_LOCATION #ifdef SHOW_LOCATION diff --git a/cpp/unittest/knowhere/knowhere_test.cpp b/cpp/unittest/knowhere/knowhere_test.cpp index 85373a0adc..8096b2821a 100644 --- a/cpp/unittest/knowhere/knowhere_test.cpp +++ b/cpp/unittest/knowhere/knowhere_test.cpp @@ -142,7 +142,7 @@ INSTANTIATE_TEST_CASE_P(WrapperParam, KnowhereWrapperTest, ) ); -TEST_P(KnowhereWrapperTest, base_test) { +TEST_P(KnowhereWrapperTest, BASE_TEST) { EXPECT_EQ(index_->GetType(), index_type); auto elems = nq * k; @@ -154,7 +154,7 @@ TEST_P(KnowhereWrapperTest, base_test) { AssertResult(res_ids, res_dis); } -TEST_P(KnowhereWrapperTest, to_gpu_test) { +TEST_P(KnowhereWrapperTest, TO_GPU_TEST) { EXPECT_EQ(index_->GetType(), index_type); auto elems = nq * k; @@ -174,7 +174,7 @@ TEST_P(KnowhereWrapperTest, to_gpu_test) { } { - std::string file_location = "/tmp/test_gpu_file"; + std::string file_location = "/tmp/knowhere_gpu_file"; write_index(index_, file_location); auto new_index = read_index(file_location); @@ -186,11 +186,11 @@ TEST_P(KnowhereWrapperTest, to_gpu_test) { } } -TEST_P(KnowhereWrapperTest, to_cpu_test) { +TEST_P(KnowhereWrapperTest, TO_CPU_TEST) { // dev } -TEST_P(KnowhereWrapperTest, serialize) { +TEST_P(KnowhereWrapperTest, SERIALIZE_TEST) { EXPECT_EQ(index_->GetType(), index_type); auto elems = nq * k; @@ -215,7 +215,7 @@ TEST_P(KnowhereWrapperTest, serialize) { } { - std::string file_location = "/tmp/whatever"; + std::string file_location = "/tmp/knowhere"; write_index(index_, file_location); auto new_index = read_index(file_location); EXPECT_EQ(new_index->GetType(), ConvertToCpuIndexType(index_type)); diff --git a/cpp/unittest/metrics/metrics_test.cpp b/cpp/unittest/metrics/metrics_test.cpp index d33ace6868..edbbb58035 100644 --- a/cpp/unittest/metrics/metrics_test.cpp +++ b/cpp/unittest/metrics/metrics_test.cpp @@ -24,7 +24,7 @@ using namespace zilliz::milvus; -TEST_F(MetricTest, Metric_Tes) { +TEST_F(MetricTest, METRIC_TEST) { server::ConfigNode &configNode = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_METRIC); configNode.SetValue(server::CONFIG_METRIC_COLLECTOR, "zabbix"); server::Metrics::GetInstance(); @@ -122,7 +122,7 @@ TEST_F(MetricTest, Metric_Tes) { delete [] qxb; }; -TEST_F(MetricTest, Collector_Metrics_Test){ +TEST_F(MetricTest, COLLECTOR_METRICS_TEST){ engine::Status status = engine::Status::OK(); server::CollectInsertMetrics insert_metrics0(0, status); status = engine::Status(DB_ERROR, "error"); diff --git a/cpp/unittest/scheduler/algorithm_test.cpp b/cpp/unittest/scheduler/algorithm_test.cpp index 43e6c4eae2..eeb7fc64f3 100644 --- a/cpp/unittest/scheduler/algorithm_test.cpp +++ b/cpp/unittest/scheduler/algorithm_test.cpp @@ -53,7 +53,7 @@ class AlgorithmTest : public testing::Test { ResourceMgrPtr res_mgr_; }; -TEST_F(AlgorithmTest, ShortestPath_test) { +TEST_F(AlgorithmTest, SHORTESTPATH_TEST) { std::vector sp; uint64_t cost; cost = ShortestPath(disk_.lock(), gpu_0_.lock(), res_mgr_, sp); diff --git a/cpp/unittest/scheduler/event_test.cpp b/cpp/unittest/scheduler/event_test.cpp index d2814b4da1..0c5ec21037 100644 --- a/cpp/unittest/scheduler/event_test.cpp +++ b/cpp/unittest/scheduler/event_test.cpp @@ -15,7 +15,7 @@ namespace zilliz { namespace milvus { namespace engine { -TEST(EventTest, start_up_event) { +TEST(EventTest, START_UP_EVENT) { ResourceWPtr res(ResourcePtr(nullptr)); auto event = std::make_shared(res); ASSERT_FALSE(event->Dump().empty()); @@ -23,7 +23,7 @@ TEST(EventTest, start_up_event) { std::cout << *EventPtr(event); } -TEST(EventTest, load_completed_event) { +TEST(EventTest, LOAD_COMPLETED_EVENT) { ResourceWPtr res(ResourcePtr(nullptr)); auto event = std::make_shared(res, nullptr); ASSERT_FALSE(event->Dump().empty()); @@ -31,7 +31,7 @@ TEST(EventTest, load_completed_event) { std::cout << *EventPtr(event); } -TEST(EventTest, finish_task_event) { +TEST(EventTest, FINISH_TASK_EVENT) { ResourceWPtr res(ResourcePtr(nullptr)); auto event = std::make_shared(res, nullptr); ASSERT_FALSE(event->Dump().empty()); @@ -40,7 +40,7 @@ TEST(EventTest, finish_task_event) { } -TEST(EventTest, tasktable_updated_event) { +TEST(EventTest, TASKTABLE_UPDATED_EVENT) { ResourceWPtr res(ResourcePtr(nullptr)); auto event = std::make_shared(res); ASSERT_FALSE(event->Dump().empty()); diff --git a/cpp/unittest/scheduler/node_test.cpp b/cpp/unittest/scheduler/node_test.cpp index 642bdce773..dfe0398d22 100644 --- a/cpp/unittest/scheduler/node_test.cpp +++ b/cpp/unittest/scheduler/node_test.cpp @@ -28,7 +28,7 @@ protected: NodePtr isolated_node2_; }; -TEST_F(NodeTest, add_neighbour) { +TEST_F(NodeTest, ADD_NEIGHBOUR) { ASSERT_EQ(isolated_node1_->GetNeighbours().size(), 0); ASSERT_EQ(isolated_node2_->GetNeighbours().size(), 0); auto pcie = Connection("PCIe", 11.0); @@ -37,7 +37,7 @@ TEST_F(NodeTest, add_neighbour) { ASSERT_EQ(isolated_node2_->GetNeighbours().size(), 0); } -TEST_F(NodeTest, repeat_add_neighbour) { +TEST_F(NodeTest, REPEAT_ADD_NEIGHBOUR) { ASSERT_EQ(isolated_node1_->GetNeighbours().size(), 0); ASSERT_EQ(isolated_node2_->GetNeighbours().size(), 0); auto pcie = Connection("PCIe", 11.0); @@ -47,7 +47,7 @@ TEST_F(NodeTest, repeat_add_neighbour) { ASSERT_EQ(isolated_node2_->GetNeighbours().size(), 0); } -TEST_F(NodeTest, get_neighbours) { +TEST_F(NodeTest, GET_NEIGHBOURS) { { bool n2 = false, n3 = false; auto node1_neighbours = node1_->GetNeighbours(); @@ -72,7 +72,7 @@ TEST_F(NodeTest, get_neighbours) { } } -TEST_F(NodeTest, dump) { +TEST_F(NodeTest, DUMP) { std::cout << node1_->Dump(); ASSERT_FALSE(node1_->Dump().empty()); diff --git a/cpp/unittest/scheduler/normal_test.cpp b/cpp/unittest/scheduler/normal_test.cpp index c679a356bd..8c096c4df8 100644 --- a/cpp/unittest/scheduler/normal_test.cpp +++ b/cpp/unittest/scheduler/normal_test.cpp @@ -11,7 +11,7 @@ using namespace zilliz::milvus::engine; -TEST(normal_test, inst_test) { +TEST(NormalTest, INST_TEST) { // ResourceMgr only compose resources, provide unified event auto res_mgr = ResMgrInst::GetInstance(); diff --git a/cpp/unittest/scheduler/resource_factory_test.cpp b/cpp/unittest/scheduler/resource_factory_test.cpp index fdd3a4d263..82b05f6215 100644 --- a/cpp/unittest/scheduler/resource_factory_test.cpp +++ b/cpp/unittest/scheduler/resource_factory_test.cpp @@ -4,7 +4,7 @@ using namespace zilliz::milvus::engine; -TEST(resource_factory_test, create) { +TEST(ResourceFactoryTest, CREATE) { auto disk = ResourceFactory::Create("ssd", "DISK", 0); auto cpu = ResourceFactory::Create("cpu", "CPU", 0); auto gpu = ResourceFactory::Create("gpu", "GPU", 0); diff --git a/cpp/unittest/scheduler/resource_mgr_test.cpp b/cpp/unittest/scheduler/resource_mgr_test.cpp index c4a659bed3..180072d87e 100644 --- a/cpp/unittest/scheduler/resource_mgr_test.cpp +++ b/cpp/unittest/scheduler/resource_mgr_test.cpp @@ -44,19 +44,19 @@ protected: ResourcePtr gpu_res; }; -TEST_F(ResourceMgrBaseTest, add) { +TEST_F(ResourceMgrBaseTest, ADD) { auto resource = std::make_shared("test", 0, true, true); auto ret = empty_mgr_->Add(ResourcePtr(resource)); ASSERT_EQ(ret.lock(), resource); } -TEST_F(ResourceMgrBaseTest, add_disk) { +TEST_F(ResourceMgrBaseTest, ADD_DISK) { auto resource = std::make_shared("disk", 0, true, true); auto ret = empty_mgr_->Add(ResourcePtr(resource)); ASSERT_EQ(ret.lock(), resource); } -TEST_F(ResourceMgrBaseTest, connect) { +TEST_F(ResourceMgrBaseTest, CONNECT) { auto resource1 = std::make_shared("resource1", 0, true, true); auto resource2 = std::make_shared("resource2", 2, true, true); empty_mgr_->Add(resource1); @@ -66,7 +66,7 @@ TEST_F(ResourceMgrBaseTest, connect) { } -TEST_F(ResourceMgrBaseTest, invalid_connect) { +TEST_F(ResourceMgrBaseTest, INVALID_CONNECT) { auto resource1 = std::make_shared("resource1", 0, true, true); auto resource2 = std::make_shared("resource2", 2, true, true); empty_mgr_->Add(resource1); @@ -76,19 +76,19 @@ TEST_F(ResourceMgrBaseTest, invalid_connect) { } -TEST_F(ResourceMgrBaseTest, clear) { +TEST_F(ResourceMgrBaseTest, CLEAR) { ASSERT_EQ(mgr1_->GetNumOfResource(), 3); mgr1_->Clear(); ASSERT_EQ(mgr1_->GetNumOfResource(), 0); } -TEST_F(ResourceMgrBaseTest, get_disk_resources) { +TEST_F(ResourceMgrBaseTest, GET_DISK_RESOURCES) { auto disks = mgr1_->GetDiskResources(); ASSERT_EQ(disks.size(), 1); ASSERT_EQ(disks[0].lock(), disk_res); } -TEST_F(ResourceMgrBaseTest, get_all_resources) { +TEST_F(ResourceMgrBaseTest, GET_ALL_RESOURCES) { bool disk = false, cpu = false, gpu = false; auto resources = mgr1_->GetAllResources(); ASSERT_EQ(resources.size(), 3); @@ -103,13 +103,13 @@ TEST_F(ResourceMgrBaseTest, get_all_resources) { ASSERT_TRUE(gpu); } -TEST_F(ResourceMgrBaseTest, get_compute_resources) { +TEST_F(ResourceMgrBaseTest, GET_COMPUTE_RESOURCES) { auto compute_resources = mgr1_->GetComputeResources(); ASSERT_EQ(compute_resources.size(), 1); ASSERT_EQ(compute_resources[0], gpu_res); } -TEST_F(ResourceMgrBaseTest, get_resource_by_type_and_deviceid) { +TEST_F(ResourceMgrBaseTest, GET_RESOURCE_BY_TYPE_AND_DEVICEID) { auto cpu = mgr1_->GetResource(ResourceType::CPU, 1); ASSERT_EQ(cpu, cpu_res); @@ -117,7 +117,7 @@ TEST_F(ResourceMgrBaseTest, get_resource_by_type_and_deviceid) { ASSERT_EQ(invalid, nullptr); } -TEST_F(ResourceMgrBaseTest, get_resource_by_name) { +TEST_F(ResourceMgrBaseTest, GET_RESOURCE_BY_NAME) { auto disk = mgr1_->GetResource("disk"); ASSERT_EQ(disk, disk_res); @@ -125,26 +125,26 @@ TEST_F(ResourceMgrBaseTest, get_resource_by_name) { ASSERT_EQ(invalid, nullptr); } -TEST_F(ResourceMgrBaseTest, get_num_of_resource) { +TEST_F(ResourceMgrBaseTest, GET_NUM_OF_RESOURCE) { ASSERT_EQ(empty_mgr_->GetNumOfResource(), 0); ASSERT_EQ(mgr1_->GetNumOfResource(), 3); } -TEST_F(ResourceMgrBaseTest, get_num_of_compute_resource) { +TEST_F(ResourceMgrBaseTest, GET_NUM_OF_COMPUTE_RESOURCE) { ASSERT_EQ(empty_mgr_->GetNumOfComputeResource(), 0); ASSERT_EQ(mgr1_->GetNumOfComputeResource(), 1); } -TEST_F(ResourceMgrBaseTest, get_num_of_gpu_resource) { +TEST_F(ResourceMgrBaseTest, GET_NUM_OF_GPU_RESOURCE) { ASSERT_EQ(empty_mgr_->GetNumGpuResource(), 0); ASSERT_EQ(mgr1_->GetNumGpuResource(), 1); } -TEST_F(ResourceMgrBaseTest, dump) { +TEST_F(ResourceMgrBaseTest, DUMP) { ASSERT_FALSE(mgr1_->Dump().empty()); } -TEST_F(ResourceMgrBaseTest, dump_tasktables) { +TEST_F(ResourceMgrBaseTest, DUMP_TASKTABLES) { ASSERT_FALSE(mgr1_->DumpTaskTables().empty()); } @@ -169,7 +169,7 @@ class ResourceMgrAdvanceTest : public testing::Test { ResourcePtr disk_res; }; -TEST_F(ResourceMgrAdvanceTest, register_subscriber) { +TEST_F(ResourceMgrAdvanceTest, REGISTER_SUBSCRIBER) { bool flag = false; auto callback = [&](EventPtr event) { flag = true; diff --git a/cpp/unittest/scheduler/resource_test.cpp b/cpp/unittest/scheduler/resource_test.cpp index 8a51bac5f9..0eb2de8e33 100644 --- a/cpp/unittest/scheduler/resource_test.cpp +++ b/cpp/unittest/scheduler/resource_test.cpp @@ -46,42 +46,42 @@ protected: ResourcePtr both_disable_ = nullptr; }; -TEST_F(ResourceBaseTest, name) { +TEST_F(ResourceBaseTest, NAME) { ASSERT_EQ(only_loader_->name(), name1); ASSERT_EQ(only_executor_->name(), name2); ASSERT_EQ(both_enable_->name(), name3); ASSERT_EQ(both_disable_->name(), name4); } -TEST_F(ResourceBaseTest, type) { +TEST_F(ResourceBaseTest, TYPE) { ASSERT_EQ(only_loader_->type(), ResourceType::DISK); ASSERT_EQ(only_executor_->type(), ResourceType::CPU); ASSERT_EQ(both_enable_->type(), ResourceType::GPU); ASSERT_EQ(both_disable_->type(), ResourceType::TEST); } -TEST_F(ResourceBaseTest, device_id) { +TEST_F(ResourceBaseTest, DEVICE_ID) { ASSERT_EQ(only_loader_->device_id(), id1); ASSERT_EQ(only_executor_->device_id(), id2); ASSERT_EQ(both_enable_->device_id(), id3); ASSERT_EQ(both_disable_->device_id(), id4); } -TEST_F(ResourceBaseTest, has_loader) { +TEST_F(ResourceBaseTest, HAS_LOADER) { ASSERT_TRUE(only_loader_->HasLoader()); ASSERT_FALSE(only_executor_->HasLoader()); ASSERT_TRUE(both_enable_->HasLoader()); ASSERT_FALSE(both_disable_->HasLoader()); } -TEST_F(ResourceBaseTest, has_executor) { +TEST_F(ResourceBaseTest, HAS_EXECUTOR) { ASSERT_FALSE(only_loader_->HasExecutor()); ASSERT_TRUE(only_executor_->HasExecutor()); ASSERT_TRUE(both_enable_->HasExecutor()); ASSERT_FALSE(both_disable_->HasExecutor()); } -TEST_F(ResourceBaseTest, dump) { +TEST_F(ResourceBaseTest, DUMP) { ASSERT_FALSE(only_loader_->Dump().empty()); ASSERT_FALSE(only_executor_->Dump().empty()); ASSERT_FALSE(both_enable_->Dump().empty()); @@ -165,7 +165,7 @@ protected: std::condition_variable cv_; }; -TEST_F(ResourceAdvanceTest, disk_resource_test) { +TEST_F(ResourceAdvanceTest, DISK_RESOURCE_TEST) { const uint64_t NUM = 100; std::vector> tasks; TableFileSchemaPtr dummy = nullptr; @@ -190,7 +190,7 @@ TEST_F(ResourceAdvanceTest, disk_resource_test) { } } -TEST_F(ResourceAdvanceTest, cpu_resource_test) { +TEST_F(ResourceAdvanceTest, CPU_RESOURCE_TEST) { const uint64_t NUM = 100; std::vector> tasks; TableFileSchemaPtr dummy = nullptr; @@ -215,7 +215,7 @@ TEST_F(ResourceAdvanceTest, cpu_resource_test) { } } -TEST_F(ResourceAdvanceTest, gpu_resource_test) { +TEST_F(ResourceAdvanceTest, GPU_RESOURCE_TEST) { const uint64_t NUM = 100; std::vector> tasks; TableFileSchemaPtr dummy = nullptr; @@ -240,7 +240,7 @@ TEST_F(ResourceAdvanceTest, gpu_resource_test) { } } -TEST_F(ResourceAdvanceTest, test_resource_test) { +TEST_F(ResourceAdvanceTest, TEST_RESOURCE_TEST) { const uint64_t NUM = 100; std::vector> tasks; TableFileSchemaPtr dummy = nullptr; diff --git a/cpp/unittest/scheduler/schedinst_test.cpp b/cpp/unittest/scheduler/schedinst_test.cpp index ddb3bec427..b824c20022 100644 --- a/cpp/unittest/scheduler/schedinst_test.cpp +++ b/cpp/unittest/scheduler/schedinst_test.cpp @@ -68,7 +68,7 @@ protected: const std::string CONFIG_FILE = "/tmp/milvus_sched_test/config.yaml"; }; -TEST_F(SchedInstTest, simple_gpu) { +TEST_F(SchedInstTest, SIMPLE_GPU) { StartSchedulerService(); } diff --git a/cpp/unittest/scheduler/scheduler_test.cpp b/cpp/unittest/scheduler/scheduler_test.cpp index 01baa87ece..702e1a83b6 100644 --- a/cpp/unittest/scheduler/scheduler_test.cpp +++ b/cpp/unittest/scheduler/scheduler_test.cpp @@ -138,7 +138,7 @@ insert_dummy_index_into_gpu_cache(uint64_t device_id) { cache::GpuCacheMgr::GetInstance(device_id)->InsertItem("location", obj); } -TEST_F(SchedulerTest, OnLoadCompleted) { +TEST_F(SchedulerTest, ON_LOAD_COMPLETED) { const uint64_t NUM = 10; std::vector> tasks; TableFileSchemaPtr dummy = std::make_shared(); @@ -158,7 +158,7 @@ TEST_F(SchedulerTest, OnLoadCompleted) { } -TEST_F(SchedulerTest, PushTaskToNeighbourRandomlyTest) { +TEST_F(SchedulerTest, PUSH_TASK_TO_NEIGHBOUR_RANDOMLY_TEST) { const uint64_t NUM = 10; std::vector> tasks; TableFileSchemaPtr dummy1 = std::make_shared(); @@ -229,7 +229,7 @@ protected: }; -TEST_F(SchedulerTest2, SpecifiedResourceTest) { +TEST_F(SchedulerTest2, SPECIFIED_RESOURCE_TEST) { const uint64_t NUM = 10; std::vector> tasks; TableFileSchemaPtr dummy = std::make_shared(); diff --git a/cpp/unittest/scheduler/task_test.cpp b/cpp/unittest/scheduler/task_test.cpp index f42006fc52..04071dc0c9 100644 --- a/cpp/unittest/scheduler/task_test.cpp +++ b/cpp/unittest/scheduler/task_test.cpp @@ -13,7 +13,7 @@ namespace milvus { namespace engine { -TEST(TaskTest, invalid_index) { +TEST(TaskTest, INVALID_INDEX) { auto search_task = std::make_shared(nullptr); search_task->Load(LoadType::TEST, 10); } diff --git a/cpp/unittest/scheduler/tasktable_test.cpp b/cpp/unittest/scheduler/tasktable_test.cpp index 8710aff5b5..f13ccaecf9 100644 --- a/cpp/unittest/scheduler/tasktable_test.cpp +++ b/cpp/unittest/scheduler/tasktable_test.cpp @@ -32,18 +32,18 @@ protected: std::vector items_; }; -TEST_F(TaskTableItemTest, construct) { +TEST_F(TaskTableItemTest, CONSTRUCT) { ASSERT_EQ(default_.id, 0); ASSERT_EQ(default_.task, nullptr); ASSERT_EQ(default_.state, TaskTableItemState::INVALID); } -TEST_F(TaskTableItemTest, destruct) { +TEST_F(TaskTableItemTest, DESTRUCT) { auto p_item = new TaskTableItem(); delete p_item; } -TEST_F(TaskTableItemTest, is_finish) { +TEST_F(TaskTableItemTest, IS_FINISH) { for (auto &item : items_) { if (item->state == TaskTableItemState::EXECUTED || item->state == TaskTableItemState::MOVED) { @@ -54,13 +54,13 @@ TEST_F(TaskTableItemTest, is_finish) { } } -TEST_F(TaskTableItemTest, dump) { +TEST_F(TaskTableItemTest, DUMP) { for (auto &item : items_) { ASSERT_FALSE(item->Dump().empty()); } } -TEST_F(TaskTableItemTest, load) { +TEST_F(TaskTableItemTest, LOAD) { for (auto &item : items_) { auto before_state = item->state; auto ret = item->Load(); @@ -74,7 +74,7 @@ TEST_F(TaskTableItemTest, load) { } } -TEST_F(TaskTableItemTest, loaded) { +TEST_F(TaskTableItemTest, LOADED) { for (auto &item : items_) { auto before_state = item->state; auto ret = item->Loaded(); @@ -88,7 +88,7 @@ TEST_F(TaskTableItemTest, loaded) { } } -TEST_F(TaskTableItemTest, execute) { +TEST_F(TaskTableItemTest, EXECUTE) { for (auto &item : items_) { auto before_state = item->state; auto ret = item->Execute(); @@ -103,7 +103,7 @@ TEST_F(TaskTableItemTest, execute) { } -TEST_F(TaskTableItemTest, executed) { +TEST_F(TaskTableItemTest, EXECUTED) { for (auto &item : items_) { auto before_state = item->state; auto ret = item->Executed(); @@ -117,7 +117,7 @@ TEST_F(TaskTableItemTest, executed) { } } -TEST_F(TaskTableItemTest, move) { +TEST_F(TaskTableItemTest, MOVE) { for (auto &item : items_) { auto before_state = item->state; auto ret = item->Move(); @@ -131,7 +131,7 @@ TEST_F(TaskTableItemTest, move) { } } -TEST_F(TaskTableItemTest, moved) { +TEST_F(TaskTableItemTest, MOVED) { for (auto &item : items_) { auto before_state = item->state; auto ret = item->Moved(); @@ -163,7 +163,7 @@ protected: TaskTable empty_table_; }; -TEST_F(TaskTableBaseTest, subscriber) { +TEST_F(TaskTableBaseTest, SUBSCRIBER) { bool flag = false; auto callback = [&]() { flag = true; @@ -174,46 +174,46 @@ TEST_F(TaskTableBaseTest, subscriber) { } -TEST_F(TaskTableBaseTest, put_task) { +TEST_F(TaskTableBaseTest, PUT_TASK) { empty_table_.Put(task1_); ASSERT_EQ(empty_table_.Get(0)->task, task1_); } -TEST_F(TaskTableBaseTest, put_invalid_test) { +TEST_F(TaskTableBaseTest, PUT_INVALID_TEST) { empty_table_.Put(invalid_task_); ASSERT_EQ(empty_table_.Get(0)->task, invalid_task_); } -TEST_F(TaskTableBaseTest, put_batch) { +TEST_F(TaskTableBaseTest, PUT_BATCH) { std::vector tasks{task1_, task2_}; empty_table_.Put(tasks); ASSERT_EQ(empty_table_.Get(0)->task, task1_); ASSERT_EQ(empty_table_.Get(1)->task, task2_); } -TEST_F(TaskTableBaseTest, put_empty_batch) { +TEST_F(TaskTableBaseTest, PUT_EMPTY_BATCH) { std::vector tasks{}; empty_table_.Put(tasks); } -TEST_F(TaskTableBaseTest, empty) { +TEST_F(TaskTableBaseTest, EMPTY) { ASSERT_TRUE(empty_table_.Empty()); empty_table_.Put(task1_); ASSERT_FALSE(empty_table_.Empty()); } -TEST_F(TaskTableBaseTest, size) { +TEST_F(TaskTableBaseTest, SIZE) { ASSERT_EQ(empty_table_.Size(), 0); empty_table_.Put(task1_); ASSERT_EQ(empty_table_.Size(), 1); } -TEST_F(TaskTableBaseTest, operator_) { +TEST_F(TaskTableBaseTest, OPERATOR) { empty_table_.Put(task1_); ASSERT_EQ(empty_table_.Get(0), empty_table_[0]); } -TEST_F(TaskTableBaseTest, pick_to_load) { +TEST_F(TaskTableBaseTest, PICK_TO_LOAD) { const size_t NUM_TASKS = 10; for (size_t i = 0; i < NUM_TASKS; ++i) { empty_table_.Put(task1_); @@ -226,7 +226,7 @@ TEST_F(TaskTableBaseTest, pick_to_load) { ASSERT_EQ(indexes[0], 2); } -TEST_F(TaskTableBaseTest, pick_to_load_limit) { +TEST_F(TaskTableBaseTest, PICK_TO_LOAD_LIMIT) { const size_t NUM_TASKS = 10; for (size_t i = 0; i < NUM_TASKS; ++i) { empty_table_.Put(task1_); @@ -241,7 +241,7 @@ TEST_F(TaskTableBaseTest, pick_to_load_limit) { ASSERT_EQ(indexes[2], 4); } -TEST_F(TaskTableBaseTest, pick_to_load_cache) { +TEST_F(TaskTableBaseTest, PICK_TO_LOAD_CACHE) { const size_t NUM_TASKS = 10; for (size_t i = 0; i < NUM_TASKS; ++i) { empty_table_.Put(task1_); @@ -262,7 +262,7 @@ TEST_F(TaskTableBaseTest, pick_to_load_cache) { ASSERT_EQ(indexes[0], 2); } -TEST_F(TaskTableBaseTest, pick_to_execute) { +TEST_F(TaskTableBaseTest, PICK_TO_EXECUTE) { const size_t NUM_TASKS = 10; for (size_t i = 0; i < NUM_TASKS; ++i) { empty_table_.Put(task1_); @@ -276,7 +276,7 @@ TEST_F(TaskTableBaseTest, pick_to_execute) { ASSERT_EQ(indexes[0], 2); } -TEST_F(TaskTableBaseTest, pick_to_execute_limit) { +TEST_F(TaskTableBaseTest, PICK_TO_EXECUTE_LIMIT) { const size_t NUM_TASKS = 10; for (size_t i = 0; i < NUM_TASKS; ++i) { empty_table_.Put(task1_); @@ -292,7 +292,7 @@ TEST_F(TaskTableBaseTest, pick_to_execute_limit) { ASSERT_EQ(indexes[1], 3); } -TEST_F(TaskTableBaseTest, pick_to_execute_cache) { +TEST_F(TaskTableBaseTest, PICK_TO_EXECUTE_CACHE) { const size_t NUM_TASKS = 10; for (size_t i = 0; i < NUM_TASKS; ++i) { empty_table_.Put(task1_); @@ -340,7 +340,7 @@ protected: TaskTable table1_; }; -TEST_F(TaskTableAdvanceTest, load) { +TEST_F(TaskTableAdvanceTest, LOAD) { std::vector before_state; for (auto &task : table1_) { before_state.push_back(task->state); @@ -359,7 +359,7 @@ TEST_F(TaskTableAdvanceTest, load) { } } -TEST_F(TaskTableAdvanceTest, loaded) { +TEST_F(TaskTableAdvanceTest, LOADED) { std::vector before_state; for (auto &task : table1_) { before_state.push_back(task->state); @@ -378,7 +378,7 @@ TEST_F(TaskTableAdvanceTest, loaded) { } } -TEST_F(TaskTableAdvanceTest, execute) { +TEST_F(TaskTableAdvanceTest, EXECUTE) { std::vector before_state; for (auto &task : table1_) { before_state.push_back(task->state); @@ -397,7 +397,7 @@ TEST_F(TaskTableAdvanceTest, execute) { } } -TEST_F(TaskTableAdvanceTest, executed) { +TEST_F(TaskTableAdvanceTest, EXECUTED) { std::vector before_state; for (auto &task : table1_) { before_state.push_back(task->state); @@ -416,7 +416,7 @@ TEST_F(TaskTableAdvanceTest, executed) { } } -TEST_F(TaskTableAdvanceTest, move) { +TEST_F(TaskTableAdvanceTest, MOVE) { std::vector before_state; for (auto &task : table1_) { before_state.push_back(task->state); @@ -435,7 +435,7 @@ TEST_F(TaskTableAdvanceTest, move) { } } -TEST_F(TaskTableAdvanceTest, moved) { +TEST_F(TaskTableAdvanceTest, MOVED) { std::vector before_state; for (auto &task : table1_) { before_state.push_back(task->state); diff --git a/cpp/unittest/server/util_test.cpp b/cpp/unittest/server/util_test.cpp index f51287ea4f..5896cfb6ca 100644 --- a/cpp/unittest/server/util_test.cpp +++ b/cpp/unittest/server/util_test.cpp @@ -6,6 +6,9 @@ #include #include #include +#include +#include +#include #include "utils/CommonUtil.h" #include "utils/Error.h" @@ -282,3 +285,30 @@ TEST(ValidationUtilTest, VALIDATE_DBURI_TEST) { ASSERT_EQ(server::ValidationUtil::ValidateDbURI("mysql://root:123456@127.0.0.1:3303/milvus"), SERVER_SUCCESS); ASSERT_NE(server::ValidationUtil::ValidateDbURI("mysql://root:123456@127.0.0.1:port/milvus"), SERVER_SUCCESS); } + +TEST(UtilTest, ROLLOUTHANDLER_TEST){ + std::string dir1 = "/tmp/milvus_test"; + std::string dir2 = "/tmp/milvus_test/log_test"; + std::string filename[6] = {"log_global.log", "log_debug.log", "log_warning.log", "log_trace.log", "log_error.log", "log_fatal.log"}; + + mkdir(dir1.c_str(), S_IRWXU); + mkdir(dir2.c_str(), S_IRWXU); + for (int i = 0; i < 6; ++i) { + std::string tmp = dir2 + "/" + filename[i]; + + std::ofstream file; + file.open(tmp.c_str()); + file << "zilliz" << std::endl; + + server::RolloutHandler(tmp.c_str(), 0); + + tmp.append(".1"); + std::ifstream file2; + file2.open(tmp); + + std::string tmp2; + file2 >> tmp2; + ASSERT_EQ(tmp2, "zilliz"); + } + boost::filesystem::remove_all(dir2); +} \ No newline at end of file