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/16 18:32:26 UTC

mesos git commit: Fixed the 'IOSwitchboardTest.KillSwitchboardContainerDestroyed' test.

Repository: mesos
Updated Branches:
  refs/heads/master 0d612c0bf -> 28eaa8df7


Fixed the 'IOSwitchboardTest.KillSwitchboardContainerDestroyed' test.

The container was launched with TTY enabled. This meant that
killing the switchboard would trigger the task to terminate
on its own owing to the "master" end of the TTY dying. This
would make it not go through the code path of the isolator
failing due to resource limit issue.

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


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

Branch: refs/heads/master
Commit: 28eaa8df7c95130b0c244f7613ad506be899cafd
Parents: 0d612c0
Author: Anand Mazumdar <an...@apache.org>
Authored: Wed Dec 14 17:40:47 2016 -0800
Committer: Anand Mazumdar <an...@apache.org>
Committed: Fri Dec 16 10:31:40 2016 -0800

----------------------------------------------------------------------
 .../containerizer/io_switchboard_tests.cpp      | 33 ++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/28eaa8df/src/tests/containerizer/io_switchboard_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/io_switchboard_tests.cpp b/src/tests/containerizer/io_switchboard_tests.cpp
index 5e3fb0d..074c32b 100644
--- a/src/tests/containerizer/io_switchboard_tests.cpp
+++ b/src/tests/containerizer/io_switchboard_tests.cpp
@@ -853,10 +853,6 @@ TEST_F(IOSwitchboardTest, KillSwitchboardContainerDestroyed)
       "sleep 1000",
       "cpus:1");
 
-  // Request a tty for the container to start the switchboard server.
-  executorInfo.mutable_container()->set_type(ContainerInfo::MESOS);
-  executorInfo.mutable_container()->mutable_tty_info();
-
   Future<bool> launch = containerizer->launch(
       containerId,
       None(),
@@ -869,14 +865,29 @@ TEST_F(IOSwitchboardTest, KillSwitchboardContainerDestroyed)
 
   AWAIT_ASSERT_TRUE(launch);
 
+  ContainerID childContainerId;
+  childContainerId.mutable_parent()->CopyFrom(containerId);
+  childContainerId.set_value(UUID::random().toString());
+
+  launch = containerizer->launch(
+      childContainerId,
+      createCommandInfo("sleep 1000"),
+      None(),
+      None(),
+      state.id,
+      mesos::slave::ContainerClass::DEBUG);
+
+  AWAIT_ASSERT_TRUE(launch);
+
   Result<pid_t> pid = paths::getContainerIOSwitchboardPid(
-        flags.runtime_dir, containerId);
+        flags.runtime_dir, childContainerId);
 
   ASSERT_SOME(pid);
 
   ASSERT_EQ(0, os::kill(pid.get(), SIGKILL));
 
-  Future<Option<ContainerTermination>> wait = containerizer->wait(containerId);
+  Future<Option<ContainerTermination>> wait =
+    containerizer->wait(childContainerId);
 
   AWAIT_READY(wait);
   ASSERT_SOME(wait.get());
@@ -887,6 +898,16 @@ TEST_F(IOSwitchboardTest, KillSwitchboardContainerDestroyed)
   ASSERT_TRUE(wait.get()->reasons().size() == 1);
   ASSERT_EQ(TaskStatus::REASON_IO_SWITCHBOARD_EXITED,
             wait.get()->reasons().Get(0));
+
+  wait = containerizer->wait(containerId);
+
+  containerizer->destroy(containerId);
+
+  AWAIT_READY(wait);
+  ASSERT_SOME(wait.get());
+
+  ASSERT_TRUE(wait.get()->has_status());
+  EXPECT_WTERMSIG_EQ(SIGKILL, wait.get()->status());
 }