You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2014/06/02 19:15:01 UTC
git commit: Add helper in tests/mesos.hpp to create task with
resources
Repository: mesos
Updated Branches:
refs/heads/master aebd443ab -> c5a336420
Add helper in tests/mesos.hpp to create task with resources
Review: https://reviews.apache.org/r/22048
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c5a33642
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c5a33642
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c5a33642
Branch: refs/heads/master
Commit: c5a33642068b616f378c4cb369840cabc80c9494
Parents: aebd443
Author: Ian Downes <id...@twitter.com>
Authored: Thu May 29 13:20:16 2014 -0700
Committer: Ian Downes <id...@twitter.com>
Committed: Mon Jun 2 10:14:33 2014 -0700
----------------------------------------------------------------------
src/tests/mesos.hpp | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c5a33642/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 1b0f358..9ece77a 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -290,7 +290,8 @@ protected:
// TODO(bmahler): Refactor this to make the distinction between
// command tasks and executor tasks clearer.
inline TaskInfo createTask(
- const Offer& offer,
+ const SlaveID& slaveId,
+ const Resources& resources,
const std::string& command,
const Option<mesos::ExecutorID>& executorId = None(),
const std::string& name = "test-task",
@@ -299,8 +300,8 @@ inline TaskInfo createTask(
TaskInfo task;
task.set_name(name);
task.mutable_task_id()->set_value(id);
- task.mutable_slave_id()->CopyFrom(offer.slave_id());
- task.mutable_resources()->CopyFrom(offer.resources());
+ task.mutable_slave_id()->CopyFrom(slaveId);
+ task.mutable_resources()->CopyFrom(resources);
if (executorId.isSome()) {
ExecutorInfo executor;
executor.mutable_executor_id()->CopyFrom(executorId.get());
@@ -314,6 +315,18 @@ inline TaskInfo createTask(
}
+inline TaskInfo createTask(
+ const Offer& offer,
+ const std::string& command,
+ const Option<mesos::ExecutorID>& executorId = None(),
+ const std::string& name = "test-task",
+ const std::string& id = UUID::random().toString())
+{
+ return createTask(
+ offer.slave_id(), offer.resources(), command, executorId, name, id);
+}
+
+
// Definition of a mock Scheduler to be used in tests with gmock.
class MockScheduler : public Scheduler
{