X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDistributedDataStoreIntegrationTest.java;h=bd9d68397047b93572885e6d528b8894fd570fa0;hp=4a7a8134ad7892e9a6e472aefa1a4281248225b2;hb=1402ac0fbcb87318db32b44f605621b23c94fbb3;hpb=bc2b83e97bc73930badd4a3063c65b849f82c664 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java index 4a7a8134ad..bd9d683970 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java @@ -40,7 +40,6 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; import org.junit.After; import org.junit.Before; @@ -50,6 +49,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.mockito.Mockito; +import org.opendaylight.controller.cluster.access.client.RequestTimeoutException; import org.opendaylight.controller.cluster.databroker.ClientBackedDataStore; import org.opendaylight.controller.cluster.databroker.ConcurrentDOMDataBroker; import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException; @@ -649,7 +649,7 @@ public class DistributedDataStoreIntegrationTest { // The ShardManager uses the election timeout for FindPrimary so // reset it low so it will timeout quickly. datastoreContextBuilder.shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(1) - .shardInitializationTimeout(200, TimeUnit.MILLISECONDS); + .shardInitializationTimeout(200, TimeUnit.MILLISECONDS).frontendRequestTimeoutInSeconds(2); try (AbstractDataStore dataStore = setupAbstractDataStore( testParameter, testName, false, shardName)) { @@ -699,14 +699,16 @@ public class DistributedDataStoreIntegrationTest { // should have timed out and throw an appropriate // exception cause. try { - txCohort.get().canCommit().get(5, TimeUnit.SECONDS); + txCohort.get().canCommit().get(10, TimeUnit.SECONDS); fail("Expected NoShardLeaderException"); } catch (final ExecutionException e) { - assertTrue(Throwables.getRootCause(e) instanceof NoShardLeaderException); - assertEquals(DistributedDataStore.class, testParameter); - } catch (TimeoutException e) { - // ClientBackedDataStore doesn't set cause to ExecutionException, future just time outs - assertEquals(ClientBackedDataStore.class, testParameter); + final String msg = "Unexpected exception: " + + Throwables.getStackTraceAsString(e.getCause()); + if (DistributedDataStore.class.equals(testParameter)) { + assertTrue(Throwables.getRootCause(e) instanceof NoShardLeaderException); + } else { + assertTrue(msg, Throwables.getRootCause(e) instanceof RequestTimeoutException); + } } } finally { try {