Solr
  1. Solr
  2. SOLR-3048

Fix incorrect test classpath order under the Maven build

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0-ALPHA
    • Fix Version/s: 4.0-ALPHA
    • Component/s: Build
    • Labels:
      None

      Description

      The lucene-test-framework test dependency must appear before lucene-core in the test classpath, to allow test-only read/write PreFlexRWCodec to fulfill Lucene3x codec requests instead of lucene-core's read-only Lucene3xCodec.

      SOLR-2849 refactored Solr dependencies and pulled the lucene-test-framework test dependency into the solr-parent POM, and all Solr child POMs inherit that dependency. When a Solr child module e.g. solr-core runs tests under Maven, it orders the solr-parent dependencies after its own dependencies (see MNG-3494), and so lucene-test-framework will always appear after lucene-core if it is declared in the solr-parent POM. (I searched the interweb for a mechanism to influence this ordering, and came up empty-handed...)

      Under LUCENE-3490 I committed a fix to the lucene/ and modules/ POMs, but not to any of Solr's POMs - I'm not sure why I excluded Solr at that point .

      This misconfiguration triggered a test failure today in the Lucene-Solr-Maven-trunk Jenkins build for org.apache.solr.core.TestArbitraryIndexDir.testLoadNewIndexDir:

      CheckIndex failed
      Segments file=segments_1 numSegments=1 version=4.0 format=FORMAT_4_0 [Lucene 4.0]
        1 of 1: name=_0 docCount=1
          codec=Lucene3x
          compound=false
      FAILED
          WARNING: fixIndex() would remove reference to this segment; full exception:
      org.apache.lucene.index.IndexFormatTooNewException: Format version is not supported (resource: MockIndexInputWrapper(SimpleFSIndexInput(path="/usr/home/hudson/hudson-slave/workspace/Lucene-Solr-Maven-trunk/checkout/solr/build/solr-maven/test/org.apache.solr.core.TestArbitraryIndexDir-1326913332577/solr/data/index_temp/_0.fnm"))): -2147483648 (needs to be between -2 and -3)
      	at org.apache.lucene.codecs.lucene3x.Lucene3xFieldInfosReader.read(Lucene3xFieldInfosReader.java:71)
      ...
      NOTE: reproduce with: ant test -Dtestcase=TestArbitraryIndexDir -Dtestmethod=testLoadNewIndexDir -Dtests.seed=2035db5097855cfe:-1d64b1ca3d5e4ac9:4163b1b8d4ca3ca0 -Dargs="-Dfile.encoding=ISO8859-1"
      

      I was able to reproduce locally using the following cmdline from solr/core/:

      mvn test -Dtest=TestArbitraryIndexDir -Dtests.seed=2035db5097855cfe:-1d64b1ca3d5e4ac9:4163b1b8d4ca3ca0 -Dfile.encoding=ISO8859-1
      

      The fix is to move the lucene-test-framework dependency declaration out of the solr-parent POM and back into each of the Solr child POMs under which tests are run.

        Activity

        Steve Rowe created issue -
        Hide
        Steve Rowe added a comment -

        With this patch, all tests pass, and the previously failing test using the above-listed seed is no longer failing.

        I'll commit shortly.

        Show
        Steve Rowe added a comment - With this patch, all tests pass, and the previously failing test using the above-listed seed is no longer failing. I'll commit shortly.
        Steve Rowe made changes -
        Field Original Value New Value
        Attachment SOLR-3048.patch [ 12511059 ]
        Hide
        Steve Rowe added a comment -

        Committed to trunk.

        Show
        Steve Rowe added a comment - Committed to trunk.
        Steve Rowe made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.6 [ 12319065 ]
        Resolution Fixed [ 1 ]
        Steve Rowe made changes -
        Fix Version/s 4.0 [ 12314992 ]
        Fix Version/s 3.6 [ 12319065 ]
        Hide
        David Smiley added a comment -

        Wow; that must have been an adventure to figure out.

        Show
        David Smiley added a comment - Wow; that must have been an adventure to figure out.
        Hide
        Simon Willnauer added a comment -

        thanks steven for figuring out how to fix this!

        simon

        Show
        Simon Willnauer added a comment - thanks steven for figuring out how to fix this! simon
        Hide
        Steve Rowe added a comment -

        Thanks Simon for figuring out what the problem was

        Show
        Steve Rowe added a comment - Thanks Simon for figuring out what the problem was
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Steve Rowe
            Reporter:
            Steve Rowe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development