You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2014/06/17 22:28:10 UTC

git commit: Fix SlaveRecoveryTest.Reboot test to reap executor.

Repository: mesos
Updated Branches:
  refs/heads/master 57a856686 -> 3204dc977


Fix SlaveRecoveryTest.Reboot test to reap executor.

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


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

Branch: refs/heads/master
Commit: 3204dc9775f299d989691de9ab64c1e20d6e7b25
Parents: 57a8566
Author: Ian Downes <id...@twitter.com>
Authored: Tue Jun 17 11:33:11 2014 -0700
Committer: Ian Downes <id...@twitter.com>
Committed: Tue Jun 17 13:27:29 2014 -0700

----------------------------------------------------------------------
 src/tests/slave_recovery_tests.cpp | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3204dc97/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index 8c6421b..9a73348 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -30,6 +30,7 @@
 #include <process/dispatch.hpp>
 #include <process/gmock.hpp>
 #include <process/owned.hpp>
+#include <process/reap.hpp>
 
 #include <stout/none.hpp>
 #include <stout/numify.hpp>
@@ -1436,13 +1437,40 @@ TYPED_TEST(SlaveRecoveryTest, Reboot)
   // Wait for TASK_RUNNING update.
   AWAIT_READY(status);
 
+  // Capture the container ID.
+  Future<hashset<ContainerID> > containers =
+    containerizer1.get()->containers();
+
+  AWAIT_READY(containers);
+  ASSERT_EQ(1u, containers.get().size());
+
+  ContainerID containerId = *containers.get().begin();
+
   this->Stop(slave.get());
   delete containerizer1.get();
 
-  // Shut down the executor manually so that it doesn't hang around
-  // after the test finishes.
+  // Get the executor's pid so we can reap it to properly simulate a
+  // reboot.
+  string pidPath = paths::getForkedPidPath(
+        paths::getMetaRootDir(flags.work_dir),
+        slaveId,
+        frameworkId,
+        executorId,
+        containerId);
+
+  Try<string> read = os::read(pidPath);
+  ASSERT_SOME(read);
+
+  Try<pid_t> pid = numify<pid_t>(read.get());
+  ASSERT_SOME(pid);
+
+  Future<Option<int> > executorStatus = process::reap(pid.get());
+
+  // Shut down the executor manually and wait until it's been reaped.
   process::post(executorPid, ShutdownExecutorMessage());
 
+  AWAIT_READY(executorStatus);
+
   // Modify the boot ID to simulate a reboot.
   ASSERT_SOME(os::write(
       paths::getBootIdPath(paths::getMetaRootDir(flags.work_dir)),