mirror of https://github.com/milvus-io/milvus.git
Merge branch 'branch-0.4.0' into 'branch-0.4.0'
add unittest for dump function See merge request megasearch/milvus!513 Former-commit-id: b39c951bfd57296aa334303027344bcc5ad7963epull/191/head
commit
4a3edc298b
|
@ -101,6 +101,8 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||||
- MS-511 - Update resource_test in scheduler
|
- MS-511 - Update resource_test in scheduler
|
||||||
- MS-517 - Update resource_mgr_test in scheduler
|
- MS-517 - Update resource_mgr_test in scheduler
|
||||||
- MS-518 - Add schedinst_test in scheduler
|
- MS-518 - Add schedinst_test in scheduler
|
||||||
|
- MS-519 - Add event_test in scheduler
|
||||||
|
- MS-520 - Update resource_test in scheduler
|
||||||
|
|
||||||
## New Feature
|
## New Feature
|
||||||
- MS-343 - Implement ResourceMgr
|
- MS-343 - Implement ResourceMgr
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||||
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||||
|
* Proprietary and confidential.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "scheduler/resource/Resource.h"
|
||||||
|
#include "scheduler/event/Event.h"
|
||||||
|
#include "scheduler/event/StartUpEvent.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace zilliz {
|
||||||
|
namespace milvus {
|
||||||
|
namespace engine {
|
||||||
|
|
||||||
|
TEST(EventTest, start_up_event) {
|
||||||
|
ResourceWPtr res(ResourcePtr(nullptr));
|
||||||
|
auto event = std::make_shared<StartUpEvent>(res);
|
||||||
|
ASSERT_FALSE(event->Dump().empty());
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << event;
|
||||||
|
ASSERT_FALSE(ss.str().empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(EventTest, load_completed_event) {
|
||||||
|
ResourceWPtr res(ResourcePtr(nullptr));
|
||||||
|
auto event = std::make_shared<LoadCompletedEvent>(res, nullptr);
|
||||||
|
ASSERT_FALSE(event->Dump().empty());
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << event;
|
||||||
|
ASSERT_FALSE(ss.str().empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(EventTest, finish_task_event) {
|
||||||
|
ResourceWPtr res(ResourcePtr(nullptr));
|
||||||
|
auto event = std::make_shared<FinishTaskEvent>(res, nullptr);
|
||||||
|
ASSERT_FALSE(event->Dump().empty());
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << event;
|
||||||
|
ASSERT_FALSE(ss.str().empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(EventTest, tasktable_updated_event) {
|
||||||
|
ResourceWPtr res(ResourcePtr(nullptr));
|
||||||
|
auto event = std::make_shared<TaskTableUpdatedEvent>(res);
|
||||||
|
ASSERT_FALSE(event->Dump().empty());
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << event;
|
||||||
|
ASSERT_FALSE(ss.str().empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -81,6 +81,16 @@ TEST_F(ResourceBaseTest, has_executor) {
|
||||||
ASSERT_FALSE(both_disable_->HasExecutor());
|
ASSERT_FALSE(both_disable_->HasExecutor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ResourceBaseTest, dump) {
|
||||||
|
ASSERT_FALSE(only_loader_->Dump().empty());
|
||||||
|
ASSERT_FALSE(only_executor_->Dump().empty());
|
||||||
|
ASSERT_FALSE(both_enable_->Dump().empty());
|
||||||
|
ASSERT_FALSE(both_disable_->Dump().empty());
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << only_loader_ << only_executor_ << both_enable_ << both_disable_;
|
||||||
|
ASSERT_FALSE(ss.str().empty());
|
||||||
|
}
|
||||||
|
|
||||||
/************ ResourceAdvanceTest ************/
|
/************ ResourceAdvanceTest ************/
|
||||||
|
|
||||||
class ResourceAdvanceTest : public testing::Test {
|
class ResourceAdvanceTest : public testing::Test {
|
||||||
|
|
Loading…
Reference in New Issue