From: markt Date: Sun, 19 Jun 2011 17:28:26 +0000 (+0000) Subject: Add an additional error margin to avoid false test failures X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e1b0d53a9f3533feac2669db2251a776e7171e1f;p=tomcat7.0 Add an additional error margin to avoid false test failures git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1137391 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java b/test/org/apache/catalina/core/TestAsyncContextImpl.java index d05b897b2..b2349075e 100644 --- a/test/org/apache/catalina/core/TestAsyncContextImpl.java +++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java @@ -49,6 +49,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { private static final long REQUEST_TIME = 500; // Timeout thread (where used) checks for timeout every second private static final long TIMEOUT_MARGIN = 1000; + // Timing tests need a small error margin to prevent failures + private static final long ERROR_MARGIN = 10; // Default timeout for these tests private static final long TIMEOUT = 3000; @@ -1048,8 +1050,10 @@ public class TestAsyncContextImpl extends TomcatBaseTest { for (int j = 0; j < count; j++) { Entry entry = entries.get(j); assertEquals(status, entry.getStatus()); - assertTrue(entry.toString(), entry.getTime() >= minTime); - assertTrue(entry.toString(), entry.getTime() < maxTime); + assertTrue(entry.toString(), + entry.getTime() >= minTime - ERROR_MARGIN); + assertTrue(entry.toString(), + entry.getTime() < maxTime + ERROR_MARGIN); } }