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/25 00:04:23 UTC

git commit: Fixed FrameworkReregistersFirst and SlaveReregistersFirst allocator tests.

Repository: mesos
Updated Branches:
  refs/heads/master f9506d6e5 -> 207618231


Fixed FrameworkReregistersFirst and SlaveReregistersFirst allocator tests.

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


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

Branch: refs/heads/master
Commit: 2076182314b2c65533a5a49ae3f6863a212544a3
Parents: f9506d6
Author: Vinod Kone <vi...@gmail.com>
Authored: Tue Jun 24 14:45:37 2014 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Jun 24 14:48:19 2014 -0700

----------------------------------------------------------------------
 src/tests/allocator_zookeeper_tests.cpp | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/20761823/src/tests/allocator_zookeeper_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/allocator_zookeeper_tests.cpp b/src/tests/allocator_zookeeper_tests.cpp
index 1f15cf5..091fb08 100644
--- a/src/tests/allocator_zookeeper_tests.cpp
+++ b/src/tests/allocator_zookeeper_tests.cpp
@@ -105,12 +105,19 @@ TYPED_TEST(AllocatorZooKeeperTest, FrameworkReregistersFirst)
   EXPECT_CALL(sched, statusUpdate(&driver, _))
     .WillOnce(FutureArg<1>(&status));
 
+  Future<Nothing> _statusUpdateAcknowledgement =
+    FUTURE_DISPATCH(_, &Slave::_statusUpdateAcknowledgement);
+
   driver.start();
 
   AWAIT_READY(status);
 
   EXPECT_EQ(TASK_RUNNING, status.get().state());
 
+  // Make sure the slave handles status update acknowledgement so that
+  // it doesn't try to retry the update after master failover.
+  AWAIT_READY(_statusUpdateAcknowledgement);
+
   // Stop the slave from reregistering with the new master until the
   // framework has reregistered.
   DROP_PROTOBUFS(ReregisterSlaveMessage(), _, _);
@@ -125,9 +132,6 @@ TYPED_TEST(AllocatorZooKeeperTest, FrameworkReregistersFirst)
 
   EXPECT_CALL(allocator2, initialize(_, _, _));
 
-  Try<PID<Master> > master2 = this->StartMaster(&allocator2);
-  ASSERT_SOME(master2);
-
   Future<Nothing> frameworkAdded;
   EXPECT_CALL(allocator2, frameworkAdded(_, _, _))
     .WillOnce(DoAll(InvokeFrameworkAdded(&allocator2),
@@ -135,6 +139,9 @@ TYPED_TEST(AllocatorZooKeeperTest, FrameworkReregistersFirst)
 
   EXPECT_CALL(sched, registered(&driver, _, _));
 
+  Try<PID<Master> > master2 = this->StartMaster(&allocator2);
+  ASSERT_SOME(master2);
+
   AWAIT_READY(frameworkAdded);
 
   EXPECT_CALL(allocator2, slaveAdded(_, _, _));
@@ -220,12 +227,19 @@ TYPED_TEST(AllocatorZooKeeperTest, SlaveReregistersFirst)
   EXPECT_CALL(sched, statusUpdate(&driver, _))
     .WillOnce(FutureArg<1>(&status));
 
+  Future<Nothing> _statusUpdateAcknowledgement =
+    FUTURE_DISPATCH(_, &Slave::_statusUpdateAcknowledgement);
+
   driver.start();
 
   AWAIT_READY(status);
 
   EXPECT_EQ(TASK_RUNNING, status.get().state());
 
+  // Make sure the slave handles status update acknowledgement so that
+  // it doesn't try to retry the update after master failover.
+  AWAIT_READY(_statusUpdateAcknowledgement);
+
   // Stop the framework from reregistering with the new master until the
   // slave has reregistered.
   DROP_PROTOBUFS(ReregisterFrameworkMessage(), _, _);
@@ -240,14 +254,14 @@ TYPED_TEST(AllocatorZooKeeperTest, SlaveReregistersFirst)
 
   EXPECT_CALL(allocator2, initialize(_, _, _));
 
-  Try<PID<Master> > master2 = this->StartMaster(&allocator2);
-  ASSERT_SOME(master2);
-
   Future<Nothing> slaveAdded;
   EXPECT_CALL(allocator2, slaveAdded(_, _, _))
     .WillOnce(DoAll(InvokeSlaveAdded(&allocator2),
                     FutureSatisfy(&slaveAdded)));
 
+  Try<PID<Master> > master2 = this->StartMaster(&allocator2);
+  ASSERT_SOME(master2);
+
   EXPECT_CALL(sched, registered(&driver, _, _));
 
   AWAIT_READY(slaveAdded);