You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/05/04 01:18:28 UTC
[05/13] mesos git commit: Added helper functions to create grow and
shrink volume in test.
Added helper functions to create grow and shrink volume in test.
Review: https://reviews.apache.org/r/66219/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/71057f2c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/71057f2c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/71057f2c
Branch: refs/heads/master
Commit: 71057f2c34b0ee4278be20a1da55423a81fc30a0
Parents: 8251087
Author: Zhitao Li <zh...@gmail.com>
Authored: Thu May 3 17:04:42 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Thu May 3 17:04:42 2018 -0700
----------------------------------------------------------------------
src/tests/mesos.hpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/71057f2c/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 907bca5..8da3b02 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -1342,6 +1342,32 @@ inline typename TOffer::Operation DESTROY(const TResources& volumes)
}
+template <typename TResource, typename TOffer>
+inline typename TOffer::Operation GROW_VOLUME(
+ const TResource& volume,
+ const TResource& addition)
+{
+ typename TOffer::Operation operation;
+ operation.set_type(TOffer::Operation::GROW_VOLUME);
+ operation.mutable_grow_volume()->mutable_volume()->CopyFrom(volume);
+ operation.mutable_grow_volume()->mutable_addition()->CopyFrom(addition);
+ return operation;
+}
+
+
+template <typename TResource, typename TOffer, typename TValueScalar>
+inline typename TOffer::Operation SHRINK_VOLUME(
+ const TResource& volume,
+ const TValueScalar& subtract)
+{
+ typename TOffer::Operation operation;
+ operation.set_type(TOffer::Operation::SHRINK_VOLUME);
+ operation.mutable_shrink_volume()->mutable_volume()->CopyFrom(volume);
+ operation.mutable_shrink_volume()->mutable_subtract()->CopyFrom(subtract);
+ return operation;
+}
+
+
template <typename TOffer, typename TTaskInfo>
inline typename TOffer::Operation LAUNCH(const std::vector<TTaskInfo>& tasks)
{
@@ -1745,6 +1771,20 @@ inline Offer::Operation DESTROY(Args&&... args)
}
+template <typename... Args>
+inline Offer::Operation GROW_VOLUME(Args&&... args)
+{
+ return common::GROW_VOLUME<Resource, Offer>(std::forward<Args>(args)...);
+}
+
+
+template <typename... Args>
+inline Offer::Operation SHRINK_VOLUME(Args&&... args)
+{
+ return common::SHRINK_VOLUME<Resource, Offer>(std::forward<Args>(args)...);
+}
+
+
// We specify the argument to allow brace initialized construction.
inline Offer::Operation LAUNCH(const std::vector<TaskInfo>& tasks)
{
@@ -2043,6 +2083,22 @@ inline mesos::v1::Offer::Operation DESTROY(Args&&... args)
}
+template <typename... Args>
+inline mesos::v1::Offer::Operation GROW_VOLUME(Args&&... args)
+{
+ return common::GROW_VOLUME<mesos::v1::Resource, mesos::v1::Offer>(
+ std::forward<Args>(args)...);
+}
+
+
+template <typename... Args>
+inline mesos::v1::Offer::Operation SHRINK_VOLUME(Args&&... args)
+{
+ return common::SHRINK_VOLUME<mesos::v1::Resource, mesos::v1::Offer>(
+ std::forward<Args>(args)...);
+}
+
+
// We specify the argument to allow brace initialized construction.
inline mesos::v1::Offer::Operation LAUNCH(
const std::vector<mesos::v1::TaskInfo>& tasks)