Fix intermittent RaftActorTest failures 82/20682/1
authorTom Pantelis <tpanteli@brocade.com>
Fri, 15 May 2015 01:28:14 +0000 (21:28 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 18 May 2015 23:29:54 +0000 (23:29 +0000)
commit3199bda28731c9f336d591f258636e7ff8834102
treef618236f1d95797fe4e7df76f4a56ef65cb65548
parent0319e44734fb4f201f01d166d456a51d3d25410b
Fix intermittent RaftActorTest failures

I've seen the following test failure on jenkins several times:

  RaftActorTest.testRealSnapshotWhenReplicatedToAllIndexNotInReplicatedLog:838
expected:<Leader> but was:<Candidate>

This is a result of the short-circuiting of the election timeout scheduling
when there are no peers so it goes from from Follower -> Candidate -> Leader
quickly. The test artificially sets the behavior to Leader but the immediate
ElectionTimeout messages may cause it to switch back to Candidate and
cause assertion failures before the test completes. This didn't happen
before b/c it sets the heartbeat interval really high. To alleviate the
failures, I set a peer to elide the short-circuiting.

Change-Id: I2c086f214baefb826beb898dfe4b11b659cd1eaa
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 2f2dd5376f885a160d3204a407f24e174375a5a5)
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java