You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/01/29 22:17:35 UTC

svn commit: r1562596 - /tomcat/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java

Author: markt
Date: Wed Jan 29 21:17:35 2014
New Revision: 1562596

URL: http://svn.apache.org/r1562596
Log:
Saw a failure on Windows.
Switch to our standard pattern for waiting that allows the possibility of a long wait but will finish sooner if it can rather than using a fixed wait.

Modified:
    tomcat/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java

Modified: tomcat/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java?rev=1562596&r1=1562595&r2=1562596&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java (original)
+++ tomcat/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java Wed Jan 29 21:17:35 2014
@@ -99,9 +99,8 @@ public class TestSSOnonLoginAndBasicAuth
 
     // now compute some delays - beware of the units!
     private static final int EXTRA_DELAY_SECS = 5;
-    private static final long REASONABLE_MSECS_TO_EXPIRY =
-            (((MANAGER_SCAN_INTERVAL_SECS * MANAGER_EXPIRE_SESSIONS_FAST)
-                    + EXTRA_DELAY_SECS) * 1000);
+    private static final int TIMEOUT_WAIT_SECS =  EXTRA_DELAY_SECS +
+            (MANAGER_SCAN_INTERVAL_SECS * MANAGER_EXPIRE_SESSIONS_FAST) * 5;
 
     private static final String CLIENT_AUTH_HEADER = "authorization";
     private static final String SERVER_AUTH_HEADER = "WWW-Authenticate";
@@ -167,7 +166,7 @@ public class TestSSOnonLoginAndBasicAuth
      * Wait until the SSO session times-out, then try to re-access
      * the resource. This should be rejected with SC_FORBIDDEN 401 status.
      *
-     * Note: this test will run for slightly more than 1 minute.
+     * Note: this test should run for ~10 seconds.
      */
     @Test
     public void testBasicAccessAndSessionTimeout() throws Exception {
@@ -310,7 +309,7 @@ public class TestSSOnonLoginAndBasicAuth
      *
      * (see bugfix https://issues.apache.org/bugzilla/show_bug.cgi?id=52303)
      *
-     * Note: this test will run for slightly more than 3 minutes.
+     * Note: this test should run for ~20 seconds.
      */
     @Test
     public void testBasicExpiredAcceptProtectedWithCookies() throws Exception {
@@ -601,13 +600,27 @@ public class TestSSOnonLoginAndBasicAuth
                 // leave it to be expired by the manager
             }
         }
+
+
         try {
-            Thread.sleep(REASONABLE_MSECS_TO_EXPIRY);
+            Thread.sleep(EXTRA_DELAY_SECS * 1000);
         } catch (InterruptedException ie) {
             // ignored
         }
 
-        // paranoid verification that active sessions have now gone
+        // Paranoid verification that active sessions have now gone
+        int count = 0;
+        sessions = manager.findSessions();
+        while (sessions.length != 0 && count < TIMEOUT_WAIT_SECS) {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                // Ignore
+            }
+            sessions = manager.findSessions();
+            count++;
+        }
+
         sessions = manager.findSessions();
         assertTrue(sessions.length == 0);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org