You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2016/12/01 06:43:40 UTC

[7/7] mesos git commit: Fixed the attach output container test to use the mock containerizer.

Fixed the attach output container test to use the mock containerizer.

Otherwise, the test would fail when we add support to the
containerizer to support `attach()`.

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


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

Branch: refs/heads/master
Commit: 48f6deb2dc21611b9f67fd1d906d786c95087dd2
Parents: db4b832
Author: Anand Mazumdar <an...@apache.org>
Authored: Wed Nov 30 22:42:10 2016 -0800
Committer: Anand Mazumdar <an...@apache.org>
Committed: Wed Nov 30 22:42:10 2016 -0800

----------------------------------------------------------------------
 src/tests/api_tests.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/48f6deb2/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index a803408..ca4f1de 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -3628,7 +3628,12 @@ TEST_P(AgentAPITest, AttachContainerOutputFailure)
   Future<Nothing> __recover = FUTURE_DISPATCH(_, &Slave::__recover);
 
   StandaloneMasterDetector detector;
-  Try<Owned<cluster::Slave>> slave = StartSlave(&detector);
+  MockContainerizer mockContainerizer;
+
+  EXPECT_CALL(mockContainerizer, recover(_))
+    .WillOnce(Return(Future<Nothing>(Nothing())));
+
+  Try<Owned<cluster::Slave>> slave = StartSlave(&detector, &mockContainerizer);
 
   ASSERT_SOME(slave);
 
@@ -3642,6 +3647,9 @@ TEST_P(AgentAPITest, AttachContainerOutputFailure)
   call.mutable_attach_container_output()->mutable_container_id()
     ->set_value(UUID::random().toString());
 
+  EXPECT_CALL(mockContainerizer, attach(_))
+    .WillOnce(Return(process::Failure("Unsupported")));
+
   Future<http::Response> response = http::post(
     slave.get()->pid,
     "api/v1",
@@ -3651,6 +3659,11 @@ TEST_P(AgentAPITest, AttachContainerOutputFailure)
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::InternalServerError().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ("Unsupported", response);
+
+  // The destructor of `cluster::Slave` will try to clean up any
+  // remaining containers by inspecting the result of `containers()`.
+  EXPECT_CALL(mockContainerizer, containers())
+    .WillRepeatedly(Return(hashset<ContainerID>()));
 }