Fix IMDS test synchronization
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / DatastoreTestTask.java
index a62c0ba88f1fd5226e947160030ee651ac2c418d..74202a51e44eca6fa7980c741a4a7394c4ff6de3 100644 (file)
@@ -119,6 +119,10 @@ public class DatastoreTestTask {
 
         execute(write);
         if (registration != null) {
+            // DCL is asynchronous, we need to make sure all tasks are executed before we close the registration,
+            // otherwise they would get lost
+            dclExecutorService.shutdown();
+            dclExecutorService.awaitTermination(5, TimeUnit.SECONDS);
             registration.close();
         }