Return a NoOpTransactionContext when the Primary for a shard is not found
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DistributedDataStoreIntegrationTest.java
index 5f4ac57da04d2163f30ac519b7aa6c6e72da3752..0a0c04b91586cbbda3d41dc24c4daca83ae78ae3 100644 (file)
@@ -5,7 +5,7 @@ import akka.testkit.JavaTestKit;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
-
+import junit.framework.Assert;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -56,9 +56,7 @@ public class DistributedDataStoreIntegrationTest{
 
         distributedDataStore.onGlobalContextUpdated(TestModel.createTestContext());
 
-        // This sleep is fragile - test can fail intermittently if all Shards aren't updated with
-        // the SchemaContext in time. Is there any way we can make this deterministic?
-        Thread.sleep(2000);
+        Thread.sleep(1500);
 
         DOMStoreReadWriteTransaction transaction =
             distributedDataStore.newReadWriteTransaction();
@@ -70,6 +68,8 @@ public class DistributedDataStoreIntegrationTest{
 
         Optional<NormalizedNode<?, ?>> optional = future.get();
 
+        Assert.assertTrue(optional.isPresent());
+
         NormalizedNode<?, ?> normalizedNode = optional.get();
 
         assertEquals(TestModel.TEST_QNAME, normalizedNode.getNodeType());