Fix junit-test robustness for RequestContext class 25/40825/2
authorIrwin Dunietz <id1681@att.com>
Tue, 3 Apr 2018 22:18:58 +0000 (18:18 -0400)
committerTakamune Cho <tc012c@att.com>
Tue, 3 Apr 2018 23:55:54 +0000 (23:55 +0000)
Alter a junit test for a RequestContext class to succeed more reliably

Change-Id: I93f3ffdb846aca1daaa690e4c6b4a822c514a88b
Issue-ID: APPC-826
Signed-off-by: Irwin Dunietz <id1681@att.com>
appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/onap/appc/adapter/restHealthcheck/impl/RequestContextTest.java

index 0b41c86..1e442b0 100644 (file)
@@ -161,6 +161,12 @@ public class RequestContextTest {
         assertTrue(rc.getTotalDuration() >= 2 * delay);
         rc.reset();
         rc.delay();
+       // Ensure exceeded timeToLive
+        try {
+            Thread.sleep(1L);
+        } catch (Throwable e) {
+            // Even if interrupted, assume enough delay has occurred
+        }
         assertFalse(rc.isAlive());
         assertTrue(rc.getTotalDuration() >= 3 * delay);
     }