Fix intermittent RaftActorTest failures 13/20613/2
authorTom Pantelis <tpanteli@brocade.com>
Fri, 15 May 2015 01:28:14 +0000 (21:28 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 18 May 2015 22:38:48 +0000 (22:38 +0000)
commit2f2dd5376f885a160d3204a407f24e174375a5a5
tree9004458463791a484ea70d222e2ece72fa4ae705
parent8378749f0c15b5a381ef681cbb390d19334d0db0
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>
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java