You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2016/05/27 12:11:33 UTC

[4/7] mesos git commit: Updated test helpers with creator principal.

Updated test helpers with creator principal.

This patch updates the `createPersistentVolume` and
`createDiskInfo` test helper functions to accept an
argument specifying the creator principal to be included
in `DiskInfo.Persistence`.

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


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

Branch: refs/heads/master
Commit: 9631cd781bcc0af5a286f3e24edc2291b29b21ef
Parents: 7bc1c3c
Author: Greg Mann <gr...@mesosphere.io>
Authored: Fri May 27 13:32:59 2016 +0200
Committer: Bernd Mathiske <be...@mesosphere.io>
Committed: Fri May 27 13:32:59 2016 +0200

----------------------------------------------------------------------
 src/tests/mesos.hpp | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9631cd78/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 79bf1ff..041cd42 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -518,7 +518,8 @@ inline Resource::DiskInfo createDiskInfo(
     const Option<std::string>& containerPath,
     const Option<Volume::Mode>& mode = None(),
     const Option<std::string>& hostPath = None(),
-    const Option<Resource::DiskInfo::Source>& source = None())
+    const Option<Resource::DiskInfo::Source>& source = None(),
+    const Option<std::string>& principal = None())
 {
   Resource::DiskInfo info;
 
@@ -526,6 +527,10 @@ inline Resource::DiskInfo createDiskInfo(
     info.mutable_persistence()->set_id(persistenceId.get());
   }
 
+  if (principal.isSome()) {
+    info.mutable_persistence()->set_principal(principal.get());
+  }
+
   if (containerPath.isSome()) {
     Volume volume;
     volume.set_container_path(containerPath.get());
@@ -597,7 +602,8 @@ inline Resource createPersistentVolume(
     const std::string& persistenceId,
     const std::string& containerPath,
     const Option<std::string>& reservationPrincipal = None(),
-    const Option<Resource::DiskInfo::Source>& source = None())
+    const Option<Resource::DiskInfo::Source>& source = None(),
+    const Option<std::string>& creatorPrincipal = None())
 {
   Resource volume = Resources::parse(
       "disk",
@@ -605,7 +611,13 @@ inline Resource createPersistentVolume(
       role).get();
 
   volume.mutable_disk()->CopyFrom(
-      createDiskInfo(persistenceId, containerPath, None(), None(), source));
+      createDiskInfo(
+          persistenceId,
+          containerPath,
+          None(),
+          None(),
+          source,
+          creatorPrincipal));
 
   if (reservationPrincipal.isSome()) {
     volume.mutable_reservation()->set_principal(reservationPrincipal.get());
@@ -621,7 +633,8 @@ inline Resource createPersistentVolume(
     Resource volume,
     const std::string& persistenceId,
     const std::string& containerPath,
-    const Option<std::string>& reservationPrincipal = None())
+    const Option<std::string>& reservationPrincipal = None(),
+    const Option<std::string>& creatorPrincipal = None())
 {
   Option<Resource::DiskInfo::Source> source = None();
   if (volume.has_disk() && volume.disk().has_source()) {
@@ -629,7 +642,13 @@ inline Resource createPersistentVolume(
   }
 
   volume.mutable_disk()->CopyFrom(
-      createDiskInfo(persistenceId, containerPath, None(), None(), source));
+      createDiskInfo(
+          persistenceId,
+          containerPath,
+          None(),
+          None(),
+          source,
+          creatorPrincipal));
 
   if (reservationPrincipal.isSome()) {
     volume.mutable_reservation()->set_principal(reservationPrincipal.get());