Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-3362

Initialization error of Junit tests with solr-test-framework with IDEs and Maven

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4, 4.0-ALPHA
    • Component/s: general/test
    • Labels:
    • Environment:

      NetBeans 6.9.1, Maven 2.2.1, Solr 3.3.0

    • Lucene Fields:
      New

      Description

      I'm currently developping a new component for Solr. And in my Netbeans project, I have created two Test classes for this component: one class for simple unit tests (derived from SolrTestCaseJ4 class) and a second one for tests with sharding (derived from BaseDistributedSearchTestCase).
      When I launch a test with these two classes, I have an error in the initialization of the second class of tests (no matter the class is, this is always the second executed class which fails). The error comes from an "assert" which failed in the begining of the function "initRandom()" of LuceneTestCase class :

      assert !random.initialized;

      But, if I launch each test class separatly, all the tests succeed!

      After a discussion with Mr. Muir, the problems seems to be related to the incompatibility of the class LuceneTestCase with the functioning of Maven projects in IDEs.

      According to mister Muir:

      "
      The problem is that via ant, tests work like this (e.g. for 3 test classes):
      computeTestMethods
      beforeClass
      afterClass
      computeTestMethods
      beforeClass
      AfterClass
      computeTestMethods
      beforeClass
      afterClass

      but via an IDE, if you run it from a folder like you did, then it does this:
      computeTestMethods
      computeTestMethods
      computeTestMethods
      beforeClass
      afterClass
      beforeClass
      afterClass
      beforeClass
      afterClass
      "

        Attachments

        1. LUCENE-3362.patch
          4 kB
          Robert Muir

          Activity

            People

            • Assignee:
              rcmuir Robert Muir
              Reporter:
              gquaire GĂ©rald Quaire
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: