Uploaded image for project: 'Maven SCM'
  1. Maven SCM
  2. SCM-244

In maven-scm-test, ChangeLogCommandTckTest relies on unreliable timing and fails for some SCM systems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-rc1
    • maven-scm-api
    • None
    • Linux 2.6, JDK 1.5, Maven 2

    Description

      I encountered this problem while fixing a new Mercurial SCM provider so that all its unit tests pass.

      A Mercurial repository which can reproduce the bug can be found at http://darksleep.com/~ryan/maven-scm-provider-hg.cgi – use the mercurial client to clone this repository. The problem manifests itself in HgChangeLogCommandTckTest.

      ChangeLogCommandTckTestchecks in two revisions in sequence, and records the time between them. It then tries, using date/time filtering to retrieve only the later one.

      This may work fine for slower network based revision control systems where there is an appreciable pause between checkins, but for Mercurial, the creation of the file and its checkin often happens within the same second and so the log reports the same time for creation of both revisions.

      Therefore during the date-time range query, nothing fits between the date filter range.

      In some cases, if the checkin happens of the second file happens to occur after the second value of the date increments, the test passes, but this is the exception to the rule.

      The fix would be to modify ChangeLogCommandTckTest to perform a sleep of at least 1 second between checkins.

      To reproduce, checkout (as mentioned above) the Mercurial SCM provider and run the unit tests. You will see HgChangeLogCommandTckTest fail in the manner described above.

      Attachments

        1. maven-scm-test-TickPatch.patch
          1 kB
          Ryan Daum
        2. ChangeLogCommandTckTest-SCM-244.patch
          0.8 kB
          Ryan Daum

        Issue Links

          Activity

            People

              evenisse Emmanuel Venisse
              rdaum Ryan Daum
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: