Author: markt Date: Mon Jan 22 20:37:15 2018 New Revision: 1821943 URL: http://svn.apache.org/viewvc?rev=1821943&view=rev Log: Back-port robustness change after I observed a failure on one connector on OSX (the system was under load at the time).
Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java?rev=1821943&r1=1821942&r2=1821943&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java Mon Jan 22 20:37:15 2018 @@ -95,9 +95,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"; @@ -163,7 +162,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 { @@ -306,7 +305,7 @@ public class TestSSOnonLoginAndBasicAuth * * (see bugfix https://bz.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 { @@ -597,13 +596,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(); Assert.assertTrue(sessions.length == 0); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org