[Geoserver-devel] [jira] (GEOS-5067) Random build failure in wms DimensionHelperTest

Ben Caradoc-Davies created GEOS-5067:
----------------------------------------

             Summary: Random build failure in wms DimensionHelperTest
                 Key: GEOS-5067
                 URL: https://jira.codehaus.org/browse/GEOS-5067
             Project: GeoServer
          Issue Type: Bug
          Components: WMS
    Affects Versions: 2.2.x, 2.2-beta2
            Reporter: Ben Caradoc-Davies
            Assignee: Andrea Aime
         Attachments: DimensionHelperTest.fails-every-time.patch

DimensionHelperTest.testFormatterFuzz will Randomly fail.

The use of Random() in a unit test causes it to be nondeterministic because the default seed is calculated using the system time. This can be fixed by using Random(long).

The underlying failure is caused by a bona fide bug: a mismatch in the format that appears to occur in year one. This can be seen by applying the attached patch, which increases the number of tests from 1000 to 1000000 and sets the random seed to a fixed value (0, but 1 and 2 also work) so that it fails every time. It also improves failure detail.

{noformat}
junit.framework.ComparisonFailure: java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Australia/Perth",offset=28800000,dstSavings=0,useDaylight=false,transitions=20,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=1,MONTH=7,WEEK_OF_YEAR=33,WEEK_OF_MONTH=2,DAY_OF_MONTH=16,DAY_OF_YEAR=0,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=11,HOUR_OF_DAY=9,MINUTE=39,SECOND=19,MILLISECOND=445,ZONE_OFFSET=28800000,DST_OFFSET=0] expected:<000[1]-12-31T03:39:19.445Z> but was:<000[0]-12-31T03:39:19.445Z>
  at junit.framework.Assert.assertEquals(Assert.java:81)
  at org.geoserver.wms.capabilities.DimensionHelperTest.testFormatterFuzz(DimensionHelperTest.java:56)
{noformat}

I also suggest testing out to the year 3000 as 2000 is an infamous edge case.

--
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