Fix intermittent unit test failures 40/36440/1
authorTom Pantelis <tpanteli@brocade.com>
Fri, 18 Mar 2016 04:22:27 +0000 (00:22 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Fri, 18 Mar 2016 04:24:20 +0000 (00:24 -0400)
Change-Id: I2ef68b48de8da4cc7d82a91263976295458d011a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java

index f318c68..6a4a631 100644 (file)
@@ -774,6 +774,9 @@ public class DistributedDataStoreRemotingIntegrationTest {
 
         // Gracefully stop the leader via a Shutdown message.
 
+        sendDatastoreContextUpdate(leaderDistributedDataStore, leaderDatastoreContextBuilder.
+                shardElectionTimeoutFactor(100));
+
         FiniteDuration duration = FiniteDuration.create(5, TimeUnit.SECONDS);
         Future<ActorRef> future = leaderDistributedDataStore.getActorContext().findLocalShardAsync("cars");
         ActorRef leaderActor = Await.result(future, duration);
index 676667d..3014f7e 100644 (file)
@@ -345,17 +345,17 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
         @Override
         public void onReceive(Object message) {
             if(CanCommitTransaction.isSerializedType(message)) {
+                canCommitCount.incrementAndGet();
                 onMessage("CanCommitTransaction", message, CanCommitTransaction.fromSerializable(message),
                         builder.expCanCommitType, builder.canCommitReply);
-                canCommitCount.incrementAndGet();
             } else if(CommitTransaction.isSerializedType(message)) {
+                commitCount.incrementAndGet();
                 onMessage("CommitTransaction", message, CommitTransaction.fromSerializable(message),
                         builder.expCommitType, builder.commitReply);
-                commitCount.incrementAndGet();
             } else if(AbortTransaction.isSerializedType(message)) {
+                abortCount.incrementAndGet();
                 onMessage("AbortTransaction", message, AbortTransaction.fromSerializable(message),
                         builder.expAbortType, builder.abortReply);
-                abortCount.incrementAndGet();
             } else {
                 assertionError = new AssertionError("Unexpected message " + message);
             }