Fix intermittent PreLeaderScenarioTest failure 91/58791/1
authorTom Pantelis <tompantelis@gmail.com>
Tue, 13 Jun 2017 00:28:06 +0000 (20:28 -0400)
committerRobert Varga <nite@hq.sk>
Tue, 13 Jun 2017 08:38:10 +0000 (08:38 +0000)
java.lang.AssertionError: AppendEntries - # entries expected:<1> but was:<0>
  at org.junit.Assert.fail(Assert.java:88)
  at org.junit.Assert.failNotEquals(Assert.java:743)
  at org.junit.Assert.assertEquals(Assert.java:118)
  at org.junit.Assert.assertEquals(Assert.java:555)
  at org.opendaylight.controller.cluster.raft.PreLeaderScenarioTest.testUnComittedEntryOnLeaderChange(PreLeaderScenarioTest.java:57)

AppendEntries appendEntries = expectFirstMatching(follower1CollectorActor,
                AppendEntries.class);
assertEquals("AppendEntries - # entries", 1, appendEntries.getEntries().size());

After the payload is sent to the leader, it expects an AppendEntries sent to follower1
with a single ReplicatedLogEntry. From the test output this did occur correctly but
the MessageCollectorActor still had the initial empty AppendEntries sent on leader
startup. The test setup waits for the initial AppendEntriesReply's from both followers
prior to clearing messages in each MessageCollectorActor however the AppendEntries may
not have been delivered to follower1's MessageCollectorActor yet and thus doesn't get
cleared. We need to specifically wait for the AppendEntries in follower1's
MessageCollectorActor.

Change-Id: I638a21e75ea135c1fe24970135f564da4fc5738e
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>

No differences found