Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-3048

Fix incorrect test classpath order under the Maven build

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0-ALPHA
    • 4.0-ALPHA
    • Build
    • 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.

      Attachments

        1. SOLR-3048.patch
          9 kB
          Steven Rowe

        Activity

          People

            sarowe Steven Rowe
            sarowe Steven Rowe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: