Repository: mesos
Updated Branches:
  refs/heads/master b92a46f06 -> 764fa2cbe


Added 'shutdownExecutor' methods to the mock agent.

This patch adds both mocked and unmocked `shutdownExecutor` methods
to the mock agent to facilitate testing of failure scenarios related
to executor secret generation.

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


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

Branch: refs/heads/master
Commit: e033c1a681f8867f97c70b825cae5b3740f34c9a
Parents: b92a46f
Author: Greg Mann <[email protected]>
Authored: Thu Apr 6 17:15:32 2017 -0700
Committer: Vinod Kone <[email protected]>
Committed: Thu Apr 6 17:15:32 2017 -0700

----------------------------------------------------------------------
 src/slave/slave.hpp      |  3 ++-
 src/tests/mock_slave.cpp | 11 +++++++++++
 src/tests/mock_slave.hpp | 10 ++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e033c1a6/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index b26bdf8..77fb93a 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -172,7 +172,8 @@ public:
       const process::UPID& from,
       const KillTaskMessage& killTaskMessage);
 
-  void shutdownExecutor(
+  // Made 'virtual' for Slave mocking.
+  virtual void shutdownExecutor(
       const process::UPID& from,
       const FrameworkID& frameworkId,
       const ExecutorID& executorId);

http://git-wip-us.apache.org/repos/asf/mesos/blob/e033c1a6/src/tests/mock_slave.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mock_slave.cpp b/src/tests/mock_slave.cpp
index 35cd13d..c435ec7 100644
--- a/src/tests/mock_slave.cpp
+++ b/src/tests/mock_slave.cpp
@@ -143,6 +143,8 @@ MockSlave::MockSlave(
     .WillRepeatedly(Invoke(this, &MockSlave::unmocked_usage));
   EXPECT_CALL(*this, executorTerminated(_, _, _))
     .WillRepeatedly(Invoke(this, &MockSlave::unmocked_executorTerminated));
+  EXPECT_CALL(*this, shutdownExecutor(_, _, _))
+    .WillRepeatedly(Invoke(this, &MockSlave::unmocked_shutdownExecutor));
 }
 
 
@@ -237,6 +239,15 @@ void MockSlave::unmocked_executorTerminated(
   slave::Slave::executorTerminated(frameworkId, executorId, termination);
 }
 
+
+void MockSlave::unmocked_shutdownExecutor(
+    const UPID& from,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId)
+{
+  slave::Slave::shutdownExecutor(from, frameworkId, executorId);
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/e033c1a6/src/tests/mock_slave.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mock_slave.hpp b/src/tests/mock_slave.hpp
index 2b30b87..767ed3d 100644
--- a/src/tests/mock_slave.hpp
+++ b/src/tests/mock_slave.hpp
@@ -201,6 +201,16 @@ public:
       const process::Future<Option<
           mesos::slave::ContainerTermination>>& termination);
 
+  MOCK_METHOD3(shutdownExecutor, void(
+      const process::UPID& from,
+      const FrameworkID& frameworkId,
+      const ExecutorID& executorId));
+
+  void unmocked_shutdownExecutor(
+      const process::UPID& from,
+      const FrameworkID& frameworkId,
+      const ExecutorID& executorId);
+
 private:
   Files files;
   MockGarbageCollector gc;

Reply via email to