Solr
  1. Solr
  2. SOLR-2666

Solrj test.classpath should not include Solr core test compilation output

    Details

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

      Description

      Under solr/solrj/ on branch_3x, ant compile-test fails because of incomplete backport of the SOLR-2452 changes: TestNamedListCodec still depends on a Solr test class TestDistributedSearch.

      This problem is masked by the inclusion of Solr test compilation output in Solrj's test.classpath, which is inherited from solr/common-build.xml; when ant compile-test is run from solr/, the Solr core tests are compiled first, thus allowing Solrj test compilation to succeed.

      On trunk, ant compile-test under solr/solrj/ does not fail, because TestNamedListCodec depends on BaseDistributedSearchTestCase, located in Solr's test-framework, instead of on TestDistributedSearch. This issue should nevertheless be addressed on trunk too, to surface future inadvertent solrj test->solr core test dependencies.

        Activity

        Hide
        Steve Rowe added a comment -

        Here's the patch to fix Solrj's test.classpath, applicable to both branch_3x and trunk:

        Index: solr/solrj/build.xml
        ===================================================================
        --- solr/solrj/build.xml        (revision 1148740)
        +++ solr/solrj/build.xml        (working copy)
        @@ -20,6 +20,13 @@
         
           <import file="../common-build.xml"/>
         
        +  <!-- Specialized common-solr.test.classpath, to remove the Solr core test output -->
        +  <path id="test.classpath">
        +    <pathelement path="${common-solr.dir}/build/solr-test-framework/classes/java"/>
        +       <pathelement path="${tests.userdir}"/>
        +       <path refid="test.base.classpath"/>
        +  </path>
        +
           <target name="compile-test" depends="compile-solr-test-framework,common.compile-test"/>
         
           <target name="test" depends="compile-test,junit-mkdir,junit-sequential,junit-parallel"/>
        

        On branch_3x, this patch removes the Solr core test dependency:

        Index: solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
        ===================================================================
        --- solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java    (revision 1148740)
        +++ solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java    (working copy)
        @@ -17,9 +17,9 @@
         package org.apache.solr.common.util;
         
         import org.apache.lucene.util.LuceneTestCase;
        +import org.apache.solr.BaseDistributedSearchTestCase;
         import org.apache.solr.common.SolrDocument;
         import org.apache.solr.common.SolrDocumentList;
        -import org.apache.solr.TestDistributedSearch;
         
         import java.io.ByteArrayOutputStream;
         import java.io.ByteArrayInputStream;
        @@ -246,7 +246,7 @@
               byte[] arr = baos.toByteArray();
               // System.out.println(arr.length);
               res = (NamedList) new JavaBinCodec().unmarshal(new ByteArrayInputStream(arr));
        -      cmp = TestDistributedSearch.compare(nl,res, 0, null);
        +      cmp = BaseDistributedSearchTestCase.compare(nl, res, 0, null);
         
               if (cmp != null) {
                 System.out.println(nl);
        

        Committing shortly.

        Show
        Steve Rowe added a comment - Here's the patch to fix Solrj's test.classpath , applicable to both branch_3x and trunk: Index: solr/solrj/build.xml =================================================================== --- solr/solrj/build.xml (revision 1148740) +++ solr/solrj/build.xml (working copy) @@ -20,6 +20,13 @@ <import file= "../common-build.xml" /> + <!-- Specialized common-solr.test.classpath, to remove the Solr core test output --> + <path id= "test.classpath" > + <pathelement path= "${common-solr.dir}/build/solr-test-framework/classes/java" /> + <pathelement path= "${tests.userdir}" /> + <path refid= "test.base.classpath" /> + </path> + <target name= "compile-test" depends= "compile-solr-test-framework,common.compile-test" /> <target name= "test" depends= "compile-test,junit-mkdir,junit-sequential,junit-parallel" /> On branch_3x, this patch removes the Solr core test dependency: Index: solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java =================================================================== --- solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java (revision 1148740) +++ solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java (working copy) @@ -17,9 +17,9 @@ package org.apache.solr.common.util; import org.apache.lucene.util.LuceneTestCase; + import org.apache.solr.BaseDistributedSearchTestCase; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; - import org.apache.solr.TestDistributedSearch; import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; @@ -246,7 +246,7 @@ byte [] arr = baos.toByteArray(); // System .out.println(arr.length); res = (NamedList) new JavaBinCodec().unmarshal( new ByteArrayInputStream(arr)); - cmp = TestDistributedSearch.compare(nl,res, 0, null ); + cmp = BaseDistributedSearchTestCase.compare(nl, res, 0, null ); if (cmp != null ) { System .out.println(nl); Committing shortly.
        Hide
        Steve Rowe added a comment -

        Committed:

        • r1148763: trunk
        • r1148766: branch_3x
        Show
        Steve Rowe added a comment - Committed: r1148763: trunk r1148766: branch_3x
        Hide
        Robert Muir added a comment -

        bulk close for 3.4

        Show
        Robert Muir added a comment - bulk close for 3.4

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development