From 20e100c1377799a60976c4153e4f664578896cb9 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Fri, 18 Mar 2016 00:22:27 -0400 Subject: [PATCH] Fix intermittent unit test failures Change-Id: I2ef68b48de8da4cc7d82a91263976295458d011a Signed-off-by: Tom Pantelis --- .../DistributedDataStoreRemotingIntegrationTest.java | 3 +++ .../cluster/datastore/ThreePhaseCommitCohortProxyTest.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java index f318c68c86..6a4a6315c7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java @@ -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 future = leaderDistributedDataStore.getActorContext().findLocalShardAsync("cars"); ActorRef leaderActor = Await.result(future, duration); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java index 676667d8c2..3014f7e157 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java @@ -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); } -- 2.36.6