Support 'v1::createCallAccept()' helper with multi operations. Multiple offer operations should be supported for 'Accept' call.
Review: https://reviews.apache.org/r/57185/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/93ea4f67 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/93ea4f67 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/93ea4f67 Branch: refs/heads/master Commit: 93ea4f6737c93b2f49a25ff223188b54f43e966c Parents: 09f5c39 Author: Gilbert Song <[email protected]> Authored: Mon Mar 6 15:04:41 2017 -0800 Committer: Vinod Kone <[email protected]> Committed: Mon Mar 6 15:04:41 2017 -0800 ---------------------------------------------------------------------- .../containerizer/runtime_isolator_tests.cpp | 33 +++++++++----------- src/tests/default_executor_tests.cpp | 11 +++---- src/tests/mesos.hpp | 7 +++-- 3 files changed, 25 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/93ea4f67/src/tests/containerizer/runtime_isolator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/containerizer/runtime_isolator_tests.cpp b/src/tests/containerizer/runtime_isolator_tests.cpp index 1c1f7be..fbca31a 100644 --- a/src/tests/containerizer/runtime_isolator_tests.cpp +++ b/src/tests/containerizer/runtime_isolator_tests.cpp @@ -408,12 +408,11 @@ TEST_F(DockerRuntimeIsolatorTest, ROOT_INTERNET_CURL_NestedSimpleCommand) frameworkId, offer.agent_id()))); - mesos.send(v1::createCallAccept( - frameworkId, - offer, - v1::LAUNCH_GROUP( - executorInfo, - v1::createTaskGroupInfo({taskInfo})))); + v1::Offer::Operation launchGroup = v1::LAUNCH_GROUP( + executorInfo, + v1::createTaskGroupInfo({taskInfo})); + + mesos.send(v1::createCallAccept(frameworkId, offer, {launchGroup})); AWAIT_READY(updateRunning); ASSERT_EQ(v1::TASK_RUNNING, updateRunning->status().state()); @@ -528,12 +527,11 @@ TEST_F(DockerRuntimeIsolatorTest, ROOT_NestedDockerDefaultCmdLocalPuller) frameworkId, offer.agent_id()))); - mesos.send(v1::createCallAccept( - frameworkId, - offer, - v1::LAUNCH_GROUP( - executorInfo, - v1::createTaskGroupInfo({taskInfo})))); + v1::Offer::Operation launchGroup = v1::LAUNCH_GROUP( + executorInfo, + v1::createTaskGroupInfo({taskInfo})); + + mesos.send(v1::createCallAccept(frameworkId, offer, {launchGroup})); AWAIT_READY(updateRunning); ASSERT_EQ(v1::TASK_RUNNING, updateRunning->status().state()); @@ -649,12 +647,11 @@ TEST_F(DockerRuntimeIsolatorTest, ROOT_NestedDockerDefaultEntryptLocalPuller) frameworkId, offer.agent_id()))); - mesos.send(v1::createCallAccept( - frameworkId, - offer, - v1::LAUNCH_GROUP( - executorInfo, - v1::createTaskGroupInfo({taskInfo})))); + v1::Offer::Operation launchGroup = v1::LAUNCH_GROUP( + executorInfo, + v1::createTaskGroupInfo({taskInfo})); + + mesos.send(v1::createCallAccept(frameworkId, offer, {launchGroup})); AWAIT_READY(updateRunning); ASSERT_EQ(v1::TASK_RUNNING, updateRunning->status().state()); http://git-wip-us.apache.org/repos/asf/mesos/blob/93ea4f67/src/tests/default_executor_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/default_executor_tests.cpp b/src/tests/default_executor_tests.cpp index eaf6394..f0ce2c5 100644 --- a/src/tests/default_executor_tests.cpp +++ b/src/tests/default_executor_tests.cpp @@ -924,12 +924,11 @@ TEST_P(DefaultExecutorTest, ROOT_ContainerStatusForTask) frameworkId, offer.agent_id()))); - mesos.send(v1::createCallAccept( - frameworkId, - offer, - v1::LAUNCH_GROUP( - executorInfo, - v1::createTaskGroupInfo({task1, task2})))); + v1::Offer::Operation launchGroup = v1::LAUNCH_GROUP( + executorInfo, + v1::createTaskGroupInfo({task1, task2})); + + mesos.send(v1::createCallAccept(frameworkId, offer, {launchGroup})); AWAIT_READY(updateRunning1); AWAIT_READY(updateRunning2); http://git-wip-us.apache.org/repos/asf/mesos/blob/93ea4f67/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 45a8087..f39e243 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -1476,7 +1476,7 @@ inline mesos::v1::Parameters parameterize(Args&&... args) inline mesos::v1::scheduler::Call createCallAccept( const mesos::v1::FrameworkID& frameworkId, const mesos::v1::Offer& offer, - const mesos::v1::Offer::Operation& operation) + const std::vector<mesos::v1::Offer::Operation>& operations) { mesos::v1::scheduler::Call call; call.set_type(mesos::v1::scheduler::Call::ACCEPT); @@ -1484,7 +1484,10 @@ inline mesos::v1::scheduler::Call createCallAccept( mesos::v1::scheduler::Call::Accept* accept = call.mutable_accept(); accept->add_offer_ids()->CopyFrom(offer.id()); - accept->add_operations()->CopyFrom(operation); + + foreach (const mesos::v1::Offer::Operation& operation, operations) { + accept->add_operations()->CopyFrom(operation); + } return call; }
