You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by me...@apache.org on 2016/04/25 19:14:57 UTC

[2/4] mesos git commit: Added helper to create test agent with injected `Authorizer`.

Added helper to create test agent with injected `Authorizer`.

In addition to the fully generic interface we do provide a number of
short hand functions for creating agents in tests which allow injecting
just a single component. Add one such short hand function for creating
a test agent with an injected `Authorizer` which we will use in a
subsequent patch.

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


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

Branch: refs/heads/master
Commit: 365ec5915a29721fd04572ed891cab5ed35a78bb
Parents: a3da581
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Mon Apr 25 03:58:58 2016 -0700
Committer: Adam B <ad...@mesosphere.io>
Committed: Mon Apr 25 10:14:25 2016 -0700

----------------------------------------------------------------------
 src/tests/mesos.cpp | 19 +++++++++++++++++++
 src/tests/mesos.hpp |  6 ++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/365ec591/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 118b3b4..036c589 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -389,6 +389,25 @@ Try<Owned<cluster::Slave>> MesosTest::StartSlave(
       qoSController);
 }
 
+
+Try<Owned<cluster::Slave>> MesosTest::StartSlave(
+    mesos::master::detector::MasterDetector* detector,
+    mesos::Authorizer* authorizer,
+    const Option<slave::Flags>& flags)
+{
+  return cluster::Slave::start(
+      detector,
+      flags.isNone() ? CreateSlaveFlags() : flags.get(),
+      None(),
+      None(),
+      None(),
+      None(),
+      None(),
+      None(),
+      authorizer);
+}
+
+
 // Although the constructors and destructors for mock classes are
 // often trivial, defining them out-of-line (in a separate compilation
 // unit) improves compilation time: see MESOS-3827.

http://git-wip-us.apache.org/repos/asf/mesos/blob/365ec591/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index aeee7ac..55bdeb6 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -207,6 +207,12 @@ protected:
       mesos::slave::QoSController* qosController,
       const Option<slave::Flags>& flags = None());
 
+  // Starts a slave with the specified detector, authorizer, and flags.
+  virtual Try<process::Owned<cluster::Slave>> StartSlave(
+      mesos::master::detector::MasterDetector* detector,
+      mesos::Authorizer* authorizer,
+      const Option<slave::Flags>& flags = None());
+
   Option<zookeeper::URL> zookeeperUrl;
 
   const std::string defaultAgentResourcesString{