From 63c4777924d64d1d37524285bf46880488c929a5 Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Mon, 2 Sep 2019 17:39:45 +0800 Subject: [PATCH] add PushTaskToNeighbourRandomlyTest Former-commit-id: e0617c1042a30dddd73838e0d87524a4eaff1293 --- cpp/unittest/scheduler/scheduler_test.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cpp/unittest/scheduler/scheduler_test.cpp b/cpp/unittest/scheduler/scheduler_test.cpp index e05d31e3..b7d2ba3b 100644 --- a/cpp/unittest/scheduler/scheduler_test.cpp +++ b/cpp/unittest/scheduler/scheduler_test.cpp @@ -153,6 +153,26 @@ TEST_F(SchedulerTest, OnCopyCompleted) { sleep(3); ASSERT_EQ(res_mgr_->GetResource(ResourceType::GPU, 1)->task_table().Size(), NUM); + +} + +TEST_F(SchedulerTest, PushTaskToNeighbourRandomlyTest) { + const uint64_t NUM = 10; + std::vector> tasks; + TableFileSchemaPtr dummy1 = std::make_shared(); + dummy1->location_ = "location"; + + tasks.clear(); + + for (uint64_t i = 0; i < NUM; ++i) { + auto task = std::make_shared(dummy1); + task->label() = std::make_shared(); + tasks.push_back(task); + cpu_resource_.lock()->task_table().Put(task); + } + + sleep(3); +// ASSERT_EQ(res_mgr_->GetResource(ResourceType::GPU, 1)->task_table().Size(), NUM); } class SchedulerTest2 : public testing::Test { -- GitLab