Updated scheduler driver to send Kill Call. Review: https://reviews.apache.org/r/36463
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/be0659b8 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/be0659b8 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/be0659b8 Branch: refs/heads/master Commit: be0659b85da24b8e0d312ef7cc784288e1962a62 Parents: 415f7b1 Author: Vinod Kone <[email protected]> Authored: Thu Jul 9 18:06:19 2015 -0700 Committer: Vinod Kone <[email protected]> Committed: Fri Jul 17 10:43:59 2015 -0700 ---------------------------------------------------------------------- src/sched/sched.cpp | 14 ++++++++++---- src/tests/fault_tolerance_tests.cpp | 8 +++++--- src/tests/master_tests.cpp | 9 +++++---- 3 files changed, 20 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/be0659b8/src/sched/sched.cpp ---------------------------------------------------------------------- diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp index de76803..2fe1836 100644 --- a/src/sched/sched.cpp +++ b/src/sched/sched.cpp @@ -1027,11 +1027,17 @@ protected: return; } - KillTaskMessage message; - message.mutable_framework_id()->MergeFrom(framework.id()); - message.mutable_task_id()->MergeFrom(taskId); + Call call; + + CHECK(framework.has_id()); + call.mutable_framework_id()->CopyFrom(framework.id()); + call.set_type(Call::KILL); + + Call::Kill* kill = call.mutable_kill(); + kill->mutable_task_id()->CopyFrom(taskId); + CHECK_SOME(master); - send(master.get(), message); + send(master.get(), call); } void requestResources(const vector<Request>& requests) http://git-wip-us.apache.org/repos/asf/mesos/blob/be0659b8/src/tests/fault_tolerance_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/fault_tolerance_tests.cpp b/src/tests/fault_tolerance_tests.cpp index 1070ccf..f218dc6 100644 --- a/src/tests/fault_tolerance_tests.cpp +++ b/src/tests/fault_tolerance_tests.cpp @@ -28,6 +28,8 @@ #include <mesos/master/allocator.hpp> +#include <mesos/scheduler/scheduler.hpp> + #include <process/future.hpp> #include <process/gmock.hpp> #include <process/http.hpp> @@ -1354,12 +1356,12 @@ TEST_F(FaultToleranceTest, IgnoreKillTaskFromUnregisteredFramework) EXPECT_CALL(sched2, statusUpdate(&driver2, _)) .WillOnce(FutureArg<1>(&status2)); - Future<KillTaskMessage> killTaskMessage = - FUTURE_PROTOBUF(KillTaskMessage(), _, _); + Future<mesos::scheduler::Call> killCall = FUTURE_CALL( + mesos::scheduler::Call(), mesos::scheduler::Call::KILL, _, _); driver1.killTask(status.get().task_id()); - AWAIT_READY(killTaskMessage); + AWAIT_READY(killCall); // By this point the master must have processed and ignored the // 'killTask' message from the first framework. To verify this, http://git-wip-us.apache.org/repos/asf/mesos/blob/be0659b8/src/tests/master_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp index 767c86c..13babee 100644 --- a/src/tests/master_tests.cpp +++ b/src/tests/master_tests.cpp @@ -29,6 +29,8 @@ #include <mesos/master/allocator.hpp> +#include <mesos/scheduler/scheduler.hpp> + #include <process/clock.hpp> #include <process/future.hpp> #include <process/gmock.hpp> @@ -540,9 +542,8 @@ TEST_F(MasterTest, KillUnknownTaskSlaveInTransition) EXPECT_CALL(sched, statusUpdate(&driver, _)) .Times(0); - // Set expectation that Master receives killTask message. - Future<KillTaskMessage> killTaskMessage = - FUTURE_PROTOBUF(KillTaskMessage(), _, master.get()); + Future<mesos::scheduler::Call> killCall = FUTURE_CALL( + mesos::scheduler::Call(), mesos::scheduler::Call::KILL, _, _); // Attempt to kill unknown task while slave is transitioning. TaskID unknownTaskId; @@ -554,7 +555,7 @@ TEST_F(MasterTest, KillUnknownTaskSlaveInTransition) driver.killTask(unknownTaskId); - AWAIT_READY(killTaskMessage); + AWAIT_READY(killCall); // Wait for all messages to be dispatched and processed completely to satisfy // the expectation that we didn't receive a status update.
