From: Robert Varga Date: Tue, 18 Jun 2019 15:39:37 +0000 (+0200) Subject: Fix IMDS test synchronization X-Git-Tag: release/sodium~48 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=c3ab98a0ce998f3819b105c6c049a42ed241c69e Fix IMDS test synchronization 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 --- diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java index a62c0ba88f..74202a51e4 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java @@ -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(); }