Better fix for timing issues on Linux with unit tests
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 15 Aug 2011 13:14:12 +0000 (13:14 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 15 Aug 2011 13:14:12 +0000 (13:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1157834 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/catalina/core/TestStandardContextValve.java

index b3ca5c0..78bb508 100644 (file)
@@ -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());