Fix testLeaderAndFollowerEntityOwnersReassignedAfterShutdown failure 55/63155/3
authorTom Pantelis <tompantelis@gmail.com>
Thu, 14 Sep 2017 18:50:00 +0000 (14:50 -0400)
committerRobert Varga <nite@hq.sk>
Mon, 18 Sep 2017 13:04:13 +0000 (13:04 +0000)
commitf899094ab7c5ac2a8bfe141b27ba11c5b9e34b02
tree141c6152a6edeeb429c05b137378f91734c62c93
parent81674d6fd50b419b868d0851062e23f34b34557d
Fix testLeaderAndFollowerEntityOwnersReassignedAfterShutdown failure

testLeaderAndFollowerEntityOwnersReassignedAfterShutdown(org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipIntegrationTest)  Time elapsed: 10.834 sec  <<< FAILURE!
00:35:56 java.lang.AssertionError: Last index expected:<18> but was:<19>
00:35:56  at org.junit.Assert.fail(Assert.java:88)
00:35:56  at org.junit.Assert.failNotEquals(Assert.java:743)
00:35:56  at org.junit.Assert.assertEquals(Assert.java:118)
00:35:56  at org.junit.Assert.assertEquals(Assert.java:555)
00:35:56  at org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipIntegrationTest.lambda$testLeaderAndFollowerEntityOwnersReassignedAfterShutdown$7(DistributedEntityOwnershipIntegrationTest.java:456)
00:35:56  at org.opendaylight.controller.cluster.datastore.MemberNode.verifyRaftState(MemberNode.java:147)
00:35:56  at org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipIntegrationTest.testLeaderAndFollowerEntityOwnersReassignedAfterShutdown(DistributedEntityOwnershipIntegrationTest.java:455)

The problem in this run is that lastIndex on the leader updated after
it was captured. It's difficult to know when all PurgeTransaction payloads
have been committed. The test tries to force follower1 to become leader
after the current leader is shut down but it doesn't really matter which
of the remaining followers becomes leader - we only care that the expected
entities get re-assigned. So I changed the test to enable elections on all
remaining followers and not expect a particular one to grab leadership.

Change-Id: I56a457db9ca6ba07f3a2a6378b745291c54ac99e
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java