You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2014/06/13 04:35:56 UTC

git commit: Fixed SlaveRecoveryTest.RestartBeforeContainerizerLaunch test.

Repository: mesos
Updated Branches:
  refs/heads/master d3376b677 -> c2454181e


Fixed SlaveRecoveryTest.RestartBeforeContainerizerLaunch test.

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


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

Branch: refs/heads/master
Commit: c2454181ef180587b8b3dd71f1f859b41d1475a3
Parents: d3376b6
Author: Dominic Hamon <dh...@twopensource.com>
Authored: Thu Jun 12 19:33:43 2014 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Thu Jun 12 19:35:49 2014 -0700

----------------------------------------------------------------------
 src/tests/slave_recovery_tests.cpp | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c2454181/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index e654ed0..9725e6a 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -3065,33 +3065,46 @@ TYPED_TEST(SlaveRecoveryTest, RestartBeforeContainerizerLaunch)
     .WillOnce(DoAll(FutureSatisfy(&launch),
                     Return(Future<Nothing>())));
 
+  // Ensure that wait doesn't complete so that containerizer doesn't
+  // return a failure on 'wait' due to the pending launch.
+  EXPECT_CALL(*containerizer1, wait(_))
+    .WillOnce(Return(Future<containerizer::Termination>()));
+
+  // No status update should be sent for now.
+  EXPECT_CALL(sched, statusUpdate(_, _))
+    .Times(0);
+
   driver.launchTasks(offers.get()[0].id(), tasks);
 
-  // Once we get the launch restart the slave.
+  // Once we see the call to launch, restart the slave.
   AWAIT_READY(launch);
 
   this->Stop(slave.get());
   delete containerizer1;
 
   Future<TaskStatus> status;
+  // There is a race here where the Slave may reregister before we
+  // shut down. If it does, it causes the StatusUpdateManager to
+  // flush which will cause a duplicate status update to be sent. As
+  // such, we ignore any subsequent updates.
   EXPECT_CALL(sched, statusUpdate(_, _))
-    .WillOnce(FutureArg<1>(&status));
+    .WillOnce(FutureArg<1>(&status))
+    .WillRepeatedly(Return());
 
   Future<Nothing> _recover = FUTURE_DISPATCH(_, &Slave::_recover);
 
-  TestContainerizer* containerizer2 = new TestContainerizer();
-
-  slave = this->StartSlave(containerizer2, flags);
-  ASSERT_SOME(slave);
+  TestContainerizer containerizer2;
 
   Clock::pause();
 
+  slave = this->StartSlave(&containerizer2, flags);
+  ASSERT_SOME(slave);
+
   AWAIT_READY(_recover);
 
   Clock::settle(); // Wait for slave to schedule reregister timeout.
 
   Clock::advance(EXECUTOR_REREGISTER_TIMEOUT);
-
   Clock::resume();
 
   // Scheduler should receive the TASK_FAILED update.
@@ -3102,7 +3115,6 @@ TYPED_TEST(SlaveRecoveryTest, RestartBeforeContainerizerLaunch)
   driver.join();
 
   this->Shutdown();
-  delete containerizer2;
 }