From 68c95691b62a334e4d98ca32c6fbd1046e3270a6 Mon Sep 17 00:00:00 2001 From: Irwin Dunietz Date: Tue, 3 Apr 2018 18:18:58 -0400 Subject: Fix junit-test robustness for RequestContext class Alter a junit test for a RequestContext class to succeed more reliably Change-Id: I93f3ffdb846aca1daaa690e4c6b4a822c514a88b Issue-ID: APPC-826 Signed-off-by: Irwin Dunietz --- .../onap/appc/adapter/restHealthcheck/impl/RequestContextTest.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle') diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/onap/appc/adapter/restHealthcheck/impl/RequestContextTest.java b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/onap/appc/adapter/restHealthcheck/impl/RequestContextTest.java index 0b41c861d..1e442b0c1 100644 --- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/onap/appc/adapter/restHealthcheck/impl/RequestContextTest.java +++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/onap/appc/adapter/restHealthcheck/impl/RequestContextTest.java @@ -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); } -- cgit 1.2.3-korg