Fix intermittent failure in ClusterAdminRpcServiceTest 42/41242/3
authorTom Pantelis <tpanteli@brocade.com>
Sat, 2 Jul 2016 06:09:34 +0000 (02:09 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Sun, 3 Jul 2016 05:12:30 +0000 (05:12 +0000)
testRemoveShardLeaderReplica(org.opendaylight.controller.cluster.datastore.admin.ClusterAdminRpcServiceTest)
Time elapsed: 8.187 sec  <<< FAILURE!
java.lang.AssertionError: Leader Id
Expected: (a string containing "member-2" or a string containing
"member-3")
     but: was "member-1-shard-cars-config_testRemoveShardLeaderReplica"
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.junit.Assert.assertThat(Assert.java:865)
at
org.opendaylight.controller.cluster.datastore.admin.ClusterAdminRpcServiceTest$2.verify(ClusterAdminRpcServiceTest.java:412)
at
org.opendaylight.controller.cluster.datastore.MemberNode.verifyRaftState(MemberNode.java:140)
at
org.opendaylight.controller.cluster.datastore.admin.ClusterAdminRpcServiceTest.testRemoveShardLeaderReplica(ClusterAdminRpcServiceTest.java:409)

member3 tried to become leader but hadn't gotten MemberUp for member2
yet so it didn't have its address when it sent out RequestVote. The
verification of new leader timed out before it coild try again. The call
to waitForMembersUp on line 397 should be for replica3 and not replica2.

Change-Id: I3a714c91ba974b16b2c310027b09f9658915a639
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-cluster-admin/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java

index 38368db..08996d6 100644 (file)
@@ -394,7 +394,7 @@ public class ClusterAdminRpcServiceTest {
         verifyRaftPeersPresent(replicaNode3.configDataStore(), "cars", "member-1", "member-2");
 
         replicaNode2.waitForMembersUp("member-1", "member-3");
-        replicaNode2.waitForMembersUp("member-1", "member-2");
+        replicaNode3.waitForMembersUp("member-1", "member-2");
 
         // Invoke RPC service on leader member-1 to remove it's local shard
 
index 48baef5..c03f869 100644 (file)
@@ -471,11 +471,11 @@ public class DistributedEntityOwnershipIntegrationTest {
         follower2EntityOwnershipService.registerListener(ENTITY_TYPE1, follower2MockListener);
 
         final EntityOwnershipCandidateRegistration candidate1 = leaderEntityOwnershipService.registerCandidate(ENTITY1);
+        verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1, false, true, true));
+
         final EntityOwnershipCandidateRegistration candidate2 = follower1EntityOwnershipService.registerCandidate(ENTITY1);
         final EntityOwnershipCandidateRegistration candidate3 = follower2EntityOwnershipService.registerCandidate(ENTITY1);
 
-        verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1, false, true, true));
-
         Mockito.reset(leaderMockListener);
 
         ArgumentCaptor<EntityOwnershipChange> leaderChangeCaptor = ArgumentCaptor.forClass(EntityOwnershipChange.class);

©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.