You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/11/27 19:04:57 UTC
git commit: Fixed flaky ContenderDetectorShutdownNetwork test.
Updated Branches:
refs/heads/master afc0855fe -> 3b9d480b4
Fixed flaky ContenderDetectorShutdownNetwork test.
From: Jiang Yan Xu <ya...@jxu.me>
Review: https://reviews.apache.org/r/15868
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3b9d480b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3b9d480b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3b9d480b
Branch: refs/heads/master
Commit: 3b9d480b462e4088058e0d02d0805d088df897e3
Parents: afc0855
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Wed Nov 27 10:00:53 2013 -0800
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Nov 27 10:00:53 2013 -0800
----------------------------------------------------------------------
src/tests/master_contender_detector_tests.cpp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/3b9d480b/src/tests/master_contender_detector_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_contender_detector_tests.cpp b/src/tests/master_contender_detector_tests.cpp
index 8947732..6f268ba 100644
--- a/src/tests/master_contender_detector_tests.cpp
+++ b/src/tests/master_contender_detector_tests.cpp
@@ -291,6 +291,7 @@ TEST_F(ZooKeeperMasterContenderDetectorTest, ContenderDetectorShutdownNetwork)
ZooKeeperMasterDetector detector(url.get());
Future<Result<UPID> > leader = detector.detect();
+ AWAIT_READY(leader);
EXPECT_SOME_EQ(master, leader.get());
leader = detector.detect(leader.get());
@@ -300,28 +301,29 @@ TEST_F(ZooKeeperMasterContenderDetectorTest, ContenderDetectorShutdownNetwork)
// We may need to advance multiple times because we could have
// advanced the clock before the timer in Group starts.
- while (lostCandidacy.isPending()) {
+ while (lostCandidacy.isPending() || leader.isPending()) {
Clock::advance(std::max(
MASTER_DETECTOR_ZK_SESSION_TIMEOUT,
MASTER_CONTENDER_ZK_SESSION_TIMEOUT));
Clock::settle();
}
- AWAIT_EXPECT_FAILED(lostCandidacy);
- AWAIT_READY(leader);
+ EXPECT_TRUE(lostCandidacy.isFailed());
EXPECT_ERROR(leader.get());
- // Retry.
+ // Re-contend and re-detect.
contended = contender.contend();
leader = detector.detect(leader.get());
- // Things will not change until the contender reconnects.
+ // Things will not change until the server restarts.
Clock::advance(Minutes(1));
Clock::settle();
EXPECT_TRUE(contended.isPending());
EXPECT_TRUE(leader.isPending());
server->startNetwork();
+
+ // Operations will eventually succeed after ZK is restored.
AWAIT_READY(contended);
AWAIT_READY(leader);