X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Ftest%2Ftests%2FDataBrokerTestModuleTest.java;h=4fbb8510110bfa8ace307b7f1ae8f18c428d8d55;hb=a12683b9e6445f48216ce0ca357dfcf359c8e3b3;hp=30ea7f82feb907f44299902eca63fe9c7af0142c;hpb=7ea5e81beb0b5d265713e01a14cfa2562ea28c6c;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/tests/DataBrokerTestModuleTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/tests/DataBrokerTestModuleTest.java index 30ea7f82fe..4fbb851011 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/tests/DataBrokerTestModuleTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/tests/DataBrokerTestModuleTest.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.md.sal.binding.test.tests; import static com.google.common.truth.Truth.assertThat; +import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule; @@ -23,4 +24,18 @@ public class DataBrokerTestModuleTest { public void ensureDataBrokerTestModuleWorksWithoutException() { assertThat(DataBrokerTestModule.dataBroker()).isNotNull(); } + + @Test + @Ignore // This test is flaky on build server VMs (although fine locally) + public void slowYangLoadingShouldOnlyHappenOnceAndNotDelayEachDataBroker() { + // TODO Write a lil' Timer utility class to make this kind of timing test code more readable + long startAtMs = System.currentTimeMillis(); + DataBrokerTestModule.dataBroker(); + long firstDataBrokerAtMs = System.currentTimeMillis(); + long firstDataBrokerDurationMs = firstDataBrokerAtMs - startAtMs; + DataBrokerTestModule.dataBroker(); + long secondDataBrokerDurationMs = System.currentTimeMillis() - firstDataBrokerAtMs; + assertThat(Math.abs(secondDataBrokerDurationMs - firstDataBrokerDurationMs)) + .isLessThan(firstDataBrokerDurationMs / 4); + } }