tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Burch <br...@pingtoo.com>
Subject Re: svn commit: r1415184 - in /tomcat/tc7.0.x/trunk: ./ test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java webapps/docs/changelog.xml
Date Mon, 03 Dec 2012 11:44:28 GMT
On 02/12/12 22:00, Konstantin Kolinko wrote:
> 2012/11/29  <markt@apache.org>:
>> Author: markt
>> Date: Thu Nov 29 14:35:02 2012
>> New Revision: 1415184
>>
>> URL: http://svn.apache.org/viewvc?rev=1415184&view=rev
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54190
>> Improve unit tests.
>> Patch by Brian Burch.
>>
>> Modified:
>>      tomcat/tc7.0.x/trunk/   (props changed)
>>      tomcat/tc7.0.x/trunk/test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java
>>      tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>
>> Propchange: tomcat/tc7.0.x/trunk/
>> ------------------------------------------------------------------------------
>>    Merged /tomcat/trunk:r1415177-1415179
>>
>
>> +    private static final int SHORT_TIMEOUT_MINS = 1;
>> +    private static final int LONG_TIMEOUT_MINS = 2;
>> +    private static final int MANAGER_SCAN_DELAY_SECS = 60;
>> +    private static final int EXTRA_DELAY_SECS = 5;
>> +    private static final long TIMEOUT_DELAY_MSECS =
>> +            (((SHORT_TIMEOUT_MINS * 60)
>> +                    + MANAGER_SCAN_DELAY_SECS + EXTRA_DELAY_SECS) * 1000);
>
> ...
>
>> +        // allow the session to time out and lose authentication
>> +        Thread.sleep(TIMEOUT_DELAY_MSECS);
>
>
> According to Buildbot logs, testBasicLoginSessionTimeout() runs for 2
> minutes (125 seconds), mainly due to a sleep() call.
>
> I wish there were a way to speed up this test.
>
> My thoughts
> a) Maybe use reflection to reduce StandardSession.lastAccessedTime and
> thisAccessedTime by some fixed amount (60000) instead of waiting for
> that time to pass.

That would speed up the test... but it sounds like adding a time machine 
to the test class! My feeling is this would add inappropriate logical 
complexity to a test that has always created and destroyed a tomcat 
instance for each test case (there are now 15).

However, I intend to replicate most of the improvements from this test 
class into the other authenticator tests, so I am already apprehensive 
about adding too many 60+ second delays to the entire suite.

Mark and I briefly discussed adding a new protected method for use by 
these timeout tests:

org.apache.catalina.session.StandardSession.setSessionTimeoutSecs(int secs)

What do you think?

> b) Maybe call ManagerBase.setProcessExpiresFrequency(1) instead of the
> default value (6)  and reduce MANAGER_SCAN_DELAY_SECS from 60 to 10.

Mark and I discussed this idea earlier, but I was reluctant to increase 
complexity in an already radical change to the original.

Your suggestion showed me how to achieve faster detection in a fairly 
simple manner, so I have reopened the bug and provided a new patch that 
shaves 50 seconds off the run time of the timeout test. Thanks!

> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>


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


Mime
View raw message