You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/11/04 07:00:55 UTC
[4/6] mesos git commit: Added mesos test helper
'createTaskGroupInfo()'.
Added mesos test helper 'createTaskGroupInfo()'.
Review: https://reviews.apache.org/r/53447/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dcc2e415
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dcc2e415
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dcc2e415
Branch: refs/heads/master
Commit: dcc2e415000d05a858920154a889e414b7ab92f0
Parents: e2658a1
Author: Gilbert Song <so...@gmail.com>
Authored: Thu Nov 3 22:04:10 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Nov 4 00:00:46 2016 -0700
----------------------------------------------------------------------
src/tests/mesos.hpp | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/dcc2e415/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 756e873..09c23e2 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -686,6 +686,17 @@ inline TTaskInfo createTask(
}
+template <typename TTaskGroupInfo, typename TTaskInfo>
+inline TTaskGroupInfo createTaskGroupInfo(const std::vector<TTaskInfo>& tasks)
+{
+ TTaskGroupInfo taskGroup;
+ foreach (const TTaskInfo& task, tasks) {
+ taskGroup.add_tasks()->CopyFrom(task);
+ }
+ return taskGroup;
+}
+
+
template <typename TResource, typename TLabels>
inline typename TResource::ReservationInfo createReservationInfo(
const Option<std::string>& principal = None(),
@@ -1081,6 +1092,13 @@ inline TaskInfo createTask(Args&&... args)
}
+// We specify the argument to allow brace initialized construction.
+inline TaskGroupInfo createTaskGroupInfo(const std::vector<TaskInfo>& tasks)
+{
+ return common::createTaskGroupInfo<TaskGroupInfo, TaskInfo>(tasks);
+}
+
+
template <typename... Args>
inline Resource::ReservationInfo createReservationInfo(Args&&... args)
{
@@ -1269,6 +1287,16 @@ inline mesos::v1::TaskInfo createTask(Args&&... args)
}
+// We specify the argument to allow brace initialized construction.
+inline mesos::v1::TaskGroupInfo createTaskGroupInfo(
+ const std::vector<mesos::v1::TaskInfo>& tasks)
+{
+ return common::createTaskGroupInfo<
+ mesos::v1::TaskGroupInfo,
+ mesos::v1::TaskInfo>(tasks);
+}
+
+
template <typename... Args>
inline mesos::v1::Resource::ReservationInfo createReservationInfo(
Args&&... args)