Fixed bug in GroupTest.ConnectTimer, GroupTest.TimerCleanup.

These tests looked for dispatches to `GroupProces::expired` as a way to
determine when the current Zk session has expired. However, the previous
implementation of the connect timer (`GroupProcess::timedout`) invoked
`GroupProcess::expired` directly, which meant that an `EXPECT_DISPATCH`
on the `expired` method should not fire.

However, a separate bug in `EXPECT_DISPATCH` (MESOS-5886) meant that the
test expectations were actually being satisfied by a dispatch to
`GroupProcess::timedout`, which meant the tests happened to work (!).

Fix this by changing `GroupProcess::timedout` to dispatch to `expired`
rather than invoking it directly.

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


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

Branch: refs/heads/master
Commit: d31c8f0a8ad6b247cde93daceed7e444eee85175
Parents: aadfa24
Author: Neil Conway <neil.con...@gmail.com>
Authored: Mon Jun 26 15:45:04 2017 -0700
Committer: Neil Conway <neil.con...@gmail.com>
Committed: Mon Jun 26 15:45:29 2017 -0700

----------------------------------------------------------------------
 src/zookeeper/group.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d31c8f0a/src/zookeeper/group.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/group.cpp b/src/zookeeper/group.cpp
index 9227ed1..0b823ec 100644
--- a/src/zookeeper/group.cpp
+++ b/src/zookeeper/group.cpp
@@ -497,7 +497,7 @@ void GroupProcess::timedout(int64_t sessionId)
                  << "(sessionId=" << std::hex << sessionId << ") expiration";
 
     // Locally determine that the current session has expired.
-    expired(zk->getSessionId());
+    dispatch(self(), &Self::expired, zk->getSessionId());
   }
 }
 

Reply via email to