From 1b8e237ed3a01ee9217d53eec1efa684cac1d85e Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 15 Aug 2011 13:14:12 +0000 Subject: [PATCH] Better fix for timing issues on Linux with unit tests git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1157834 13f79535-47bb-0310-9956-ffa450edef68 --- test/org/apache/catalina/core/TestStandardContextValve.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/org/apache/catalina/core/TestStandardContextValve.java b/test/org/apache/catalina/core/TestStandardContextValve.java index b3ca5c0b0..78bb50854 100644 --- a/test/org/apache/catalina/core/TestStandardContextValve.java +++ b/test/org/apache/catalina/core/TestStandardContextValve.java @@ -70,8 +70,16 @@ public class TestStandardContextValve extends TomcatBaseTest { int rc = getUrl("http://localhost:" + getPort() + "/invalid", new ByteChunk(), null); - tomcat.stop(); - tomcat.destroy(); + // Need to allow time (but not too long in case the test fails) for + // ServletRequestListener to complete + int i = 20; + while (i > 0) { + if (trace.toString().endsWith("Destroy")) { + break; + } + Thread.sleep(250); + i--; + } assertEquals(Response.SC_NOT_FOUND, rc); assertEquals("InitErrorDestroy", trace.toString()); -- 2.11.0