mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [1/2] mesos git commit: Added a test for the interaction between timers and destroyed Groups.
Date Thu, 25 Feb 2016 00:14:37 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 928ac801a -> 78fb49ba9


Added a test for the interaction between timers and destroyed Groups.

Check that even though we might fire a timer for a `GroupProcess` that
has been destroyed, this does not result in dispatching an event to a
reclaimed process.

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


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

Branch: refs/heads/master
Commit: 78fb49ba99d76ffda1cb4ca4a46618dc6c9d8a7b
Parents: 0a15a30
Author: Neil Conway <neil.conway@gmail.com>
Authored: Wed Feb 24 13:49:53 2016 -0800
Committer: Joris Van Remoortere <joris.van.remoortere@gmail.com>
Committed: Wed Feb 24 16:14:19 2016 -0800

----------------------------------------------------------------------
 src/tests/group_tests.cpp | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/78fb49ba/src/tests/group_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/group_tests.cpp b/src/tests/group_tests.cpp
index af530f3..bb548f4 100644
--- a/src/tests/group_tests.cpp
+++ b/src/tests/group_tests.cpp
@@ -447,7 +447,8 @@ TEST_F(GroupTest, ConnectTimer)
   // Ensure that we won't be able to establish a connection to ZooKeeper.
   server->shutdownNetwork();
 
-  Future<Nothing> expired = FUTURE_DISPATCH(_, &GroupProcess::expired);
+  Future<Nothing> expired = FUTURE_DISPATCH(group.process->self(),
+                                            &GroupProcess::expired);
 
   Group group(server->connectString(), sessionTimeout, "/test/");
 
@@ -460,6 +461,38 @@ TEST_F(GroupTest, ConnectTimer)
   Clock::resume();
 }
 
+
+// This test checks that if a `Group` is destroyed before the
+// connection retry timer fires, we don't attempt to dispatch a
+// message to a reclaimed process.
+TEST_F(GroupTest, TimerCleanup)
+{
+  const Duration sessionTimeout = Seconds(10);
+
+  Clock::pause();
+
+  // Ensure that we won't be able to establish a Zk connection.
+  server->shutdownNetwork();
+
+  Group* group = new Group(server->connectString(), sessionTimeout, "/test/");
+
+  // We arrange for `sessionTimeout` to expire but we expect that the
+  // associated event will not be dispatched. Note that we could
+  // specify that we expect which particular PID we expect to not
+  // receive any dispatches, but it is a stronger assertion to check
+  // that no `GroupProcess` receives an `expired` event.
+  EXPECT_NO_FUTURE_DISPATCHES(_, &GroupProcess::expired);
+
+  delete group;
+
+  Clock::advance(sessionTimeout);
+
+  // Ensure that if there are any pending messages, they are delivered.
+  Clock::settle();
+
+  Clock::resume();
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {


Mime
View raw message