Updated `RESERVE()` helper to allow specifying an operation ID.

Review: https://reviews.apache.org/r/66466/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/28b93d53
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/28b93d53
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/28b93d53

Branch: refs/heads/master
Commit: 28b93d53e2e5bfa7fd9a808aa203b178e2d8c75e
Parents: 327a4a9
Author: Gaston Kleiman <[email protected]>
Authored: Mon Apr 23 13:43:51 2018 -0700
Committer: Greg Mann <[email protected]>
Committed: Mon Apr 23 13:49:45 2018 -0700

----------------------------------------------------------------------
 src/tests/mesos.hpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/28b93d53/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index ac6684d..7a292f3 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -1296,11 +1296,18 @@ inline TDomainInfo createDomainInfo(
 
 // Helpers for creating operations.
 template <typename TResources, typename TOffer>
-inline typename TOffer::Operation RESERVE(const TResources& resources)
+inline typename TOffer::Operation RESERVE(
+    const TResources& resources,
+    const Option<std::string> operationId = None())
 {
   typename TOffer::Operation operation;
   operation.set_type(TOffer::Operation::RESERVE);
   operation.mutable_reserve()->mutable_resources()->CopyFrom(resources);
+
+  if (operationId.isSome()) {
+    operation.mutable_id()->set_value(operationId.get());
+  }
+
   return operation;
 }
 

Reply via email to