Added a mock garbage collector. Review: https://reviews.apache.org/r/66119/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/397cdd59 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/397cdd59 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/397cdd59 Branch: refs/heads/master Commit: 397cdd599470bb6626f1656e848731eec2539600 Parents: dbd5515 Author: Meng Zhu <[email protected]> Authored: Thu Apr 5 17:43:57 2018 -0700 Committer: Greg Mann <[email protected]> Committed: Thu Apr 5 17:51:29 2018 -0700 ---------------------------------------------------------------------- src/tests/mesos.cpp | 9 +++++++++ src/tests/mesos.hpp | 12 ++++++++++++ 2 files changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/397cdd59/src/tests/mesos.cpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp index 8e70150..6d09df2 100644 --- a/src/tests/mesos.cpp +++ b/src/tests/mesos.cpp @@ -682,6 +682,15 @@ MockAuthorizer::MockAuthorizer() MockAuthorizer::~MockAuthorizer() {} +MockGarbageCollector::MockGarbageCollector() +{ + EXPECT_CALL(*this, unschedule(_)).WillRepeatedly(Return(true)); +} + + +MockGarbageCollector::~MockGarbageCollector() {} + + slave::Flags ContainerizerTest<slave::MesosContainerizer>::CreateSlaveFlags() { slave::Flags flags = MesosTest::CreateSlaveFlags(); http://git-wip-us.apache.org/repos/asf/mesos/blob/397cdd59/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 4654cae..bddce3d 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -3213,6 +3213,18 @@ public: }; +// Definition of a MockGarbageCollector that can be used in tests with gmock. +class MockGarbageCollector : public slave::GarbageCollector +{ +public: + MockGarbageCollector(); + virtual ~MockGarbageCollector(); + + // The default action is to always return `true`. + MOCK_METHOD1(unschedule, process::Future<bool>(const std::string& path)); +}; + + class MockSecretGenerator : public SecretGenerator { public:
