Fix RecoveryIntegrationSingleNodeTest failure 77/58277/2
authorTom Pantelis <tompantelis@gmail.com>
Mon, 5 Jun 2017 18:56:45 +0000 (14:56 -0400)
committerRobert Varga <nite@hq.sk>
Tue, 6 Jun 2017 08:16:18 +0000 (08:16 +0000)
The InMemoryJournal may not have received all the persisted messages
by the time it checks the expected size of the journal so added a latch/wait
for he expected messages..

Change-Id: I8f050b9375f5e3e74749c17e831add21d09d1831
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RecoveryIntegrationSingleNodeTest.java

index 2a3a6c1..35c0512 100644 (file)
@@ -50,6 +50,7 @@ public class RecoveryIntegrationSingleNodeTest extends AbstractRaftActorIntegrat
         ActorRef singleNodeCollectorActor = singleNodeActorRef.underlyingActor().collectorActor();
         final RaftActorContext singleNodeContext = singleNodeActorRef.underlyingActor().getRaftActorContext();
 
+        InMemoryJournal.addWriteMessagesCompleteLatch(persistenceId, 6, ApplyJournalEntries.class);
 
         final MockRaftActorContext.MockPayload payload0 = sendPayloadData(singleNodeActorRef, "zero");
         final MockRaftActorContext.MockPayload payload1 = sendPayloadData(singleNodeActorRef, "one");
@@ -77,6 +78,8 @@ public class RecoveryIntegrationSingleNodeTest extends AbstractRaftActorIntegrat
         assertEquals("Incorrect State after snapshot success is received ", Lists.newArrayList(payload0, payload1,
                 payload2, payload3, payload4, payload5), singleNodeActorRef.underlyingActor().getState());
 
+        InMemoryJournal.waitForWriteMessagesComplete(persistenceId);
+
         // we get 2 log entries (4 and 5 indexes) and 3 ApplyJournalEntries (for 3, 4, and 5 indexes)
         assertEquals(5, InMemoryJournal.get(persistenceId).size());
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.