This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit d014360c66cf3b35708c0eb794ade9f454dcf687 Author: Alexey Serbin <[email protected]> AuthorDate: Tue Jan 28 00:27:43 2020 -0800 [tests] fix flakiness in RaftConsensusNonVoterITest Fixed flakiness in PromoteAndDemote scenario of the RaftConsensusNonVoterITest test. Due to the short heartbeat interval and concurrent activity, sometimes it takes a bit more time for a tserver to respond to RequestConsensusVote call than the Raft timeout. Prior to this fix, the scenario failed for ASAN builds in rate of 1 in ~100 runs. With the fix, I could not see it failing after multiple 1K runs. Change-Id: Ia76e4ea57f2f9d4251ad3cbed47267266fee7e28 Reviewed-on: http://gerrit.cloudera.org:8080/15115 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <[email protected]> --- src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc b/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc index 5f508d9..c4d9c86 100644 --- a/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc +++ b/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc @@ -858,8 +858,13 @@ TEST_F(RaftConsensusNonVoterITest, PromoteAndDemote) { FLAGS_num_replicas = kInitialReplicasNum; NO_FATALS(BuildAndStart(kTserverFlags, kMasterFlags)); ASSERT_FALSE(tablet_replicas_.empty()); - ASSERT_OK(StartElection(tablet_replicas_.begin()->second, tablet_id_, kTimeout)); - ASSERT_OK(WaitUntilLeader(tablet_replicas_.begin()->second, tablet_id_, kTimeout)); + ASSERT_EVENTUALLY([&]() { + const MonoDelta kElectionTimeout = MonoDelta::FromSeconds(3); + ASSERT_OK(StartElection( + tablet_replicas_.begin()->second, tablet_id_, kElectionTimeout)); + ASSERT_OK(WaitUntilLeader( + tablet_replicas_.begin()->second, tablet_id_, kElectionTimeout)); + }); ASSERT_EQ(4, tablet_servers_.size()); ASSERT_EQ(kInitialReplicasNum, tablet_replicas_.size());
