Fix IMDS test synchronization 53/82553/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jun 2019 15:39:37 +0000 (17:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jun 2019 15:42:31 +0000 (17:42 +0200)
Before we close the DTCL we must make sure we flush all changes,
otherwise we could end up losing changes simply because we are no
longer interested in them.

JIRA: MDSAL-429
Change-Id: I6df384c375ea1692a10c9f460d3dceb626468061
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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();
         }