Ben Caradoc-Davies created GEOS-5082:
----------------------------------------
Summary: Intermittent build failure caused by race condition in LRUAuthenticationCacheTest.testAuthenticationEntry
Key: GEOS-5082
URL: https://jira.codehaus.org/browse/GEOS-5082
Project: GeoServer
Issue Type: Bug
Components: Security
Affects Versions: 2.2.x
Reporter: Ben Caradoc-Davies
Assignee: Christian Mueller
LRUAuthenticationCacheTest.testAuthenticationEntry fails if a millisecond ticks over between line 54:
{noformat}
AuthenticationCacheEntry entry2 = new AuthenticationCacheEntry(t2,5,10);
{noformat}
and line 58:
{noformat}
long currentTime=System.currentTimeMillis();
{noformat}
causing the assertion at line 61 to fail:
{noformat}
assertFalse(entry2.hasExpired(currentTime+10*1000));
{noformat}
resulting in:
{noformat}
-------------------------------------------------------------------------------
Test set: org.geoserver.security.auth.LRUAuthenticationCacheTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.119 sec <<< FAILURE!
testAuthenticationEntry(org.geoserver.security.auth.LRUAuthenticationCacheTest) Time elapsed: 0.004 sec <<< FAILURE!
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at junit.framework.Assert.assertFalse(Assert.java:34)
at junit.framework.Assert.assertFalse(Assert.java:41)
at org.geoserver.security.auth.LRUAuthenticationCacheTest.testAuthenticationEntry(LRUAuthenticationCacheTest.java:61)
{noformat}
The workaround is to change line 54 to:
{noformat}
long currentTime = entry2.getCreated();
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira