Fix spurious failures in RaftActorTest due to RecoveryComplete 99/15599/2
authortpantelis <tpanteli@brocade.com>
Fri, 20 Feb 2015 10:23:09 +0000 (05:23 -0500)
committerMoiz Raja <moraja@cisco.com>
Sun, 22 Feb 2015 03:45:14 +0000 (03:45 +0000)
commitab43a3c309d46978f6fae340c9c2ef0b2755891c
tree80d83feb97e96b10e40538ae293b3b96fea72569
parent5ebdd63990602003ecf568a0675b9f5e521eade2
Fix spurious failures in RaftActorTest due to RecoveryComplete

testSaveSnapshotSuccessCallsDataPersistence fails sporadically due
to RecoveryComplete interfering with the test. In
handleCaptureSnapshotReply it sets replicatedToAllIndex in the
behavior. On RecoveryCompleted, it initializes the behavior which
creates a new Follower with replicatedToAllIndex initialized to -1.
Recovery is done asyn so if RecoveryCompleted occurs after
CaptureSnapshotReply, the test fails because replicatedToAllIndex
isn't the expected value.

We need to call waitForInitializeBehaviorComplete after creating the
MockRaftActor so recovery and behavior initialization is complete before
starting the tests.

Change-Id: I3176afbf7ac937550c33bdb57d14d6968dbc2514
Signed-off-by: tpantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java