Okay so I think I found a solution.... if you are a maven user and don't mind forcing the test codec to Lucene40 then do the following:
Add this to your pom.xml under the "<build> <pluginManagement> <plugins>" section <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.13</version> <configuration> <argLine>-Dtests.codec=Lucene40</argLine> </configuration> </plugin> If you are running in Eclipse, simply add this as a VM argument. The default "test codec" is set to "random" and this means that there is a possibility of picking Lucene3x if some random variable is < 2 and other conditions are met. For me, my test-framework jar must not be "ahead" of the lucene one (b/c I don't control the classpath order and honestly this shouldn't be a requirement to run a test) so it periodically bombed. This little fix seems to have helped provided that you don't care about Lucene3x vs Lucene40 for your tests (I am on Lucene40 so it's fine for me). HTH! Amit On Mon, Feb 4, 2013 at 6:18 PM, Roman Chyla <roman.ch...@gmail.com> wrote: > Me too, it fails randomly with test classes. We use Solr4.0 for testing, no > maven, only ant. > --roman > On 4 Feb 2013 20:48, "Mike Schultz" <mike.schu...@gmail.com> wrote: > > > Yes. Just today actually. I had some unit test based on > > AbstractSolrTestCase which worked in 4.0 but in 4.1 they would fail > > intermittently with that error message. The key to this behavior is > found > > by looking at the code in the lucene class: > > TestRuleSetupAndRestoreClassEnv. > > I don't understand it completely but there are a number of random code > > paths > > through there. The following helped me get around the problem, at least > in > > the short term. > > > > > > > @org.apache.lucene.util.LuceneTestCase.SuppressCodecs({"Lucene3x","Lucene40"}) > > public class CoreLevelTest extends AbstractSolrTestCase { > > > > I also need to call this inside my setUp() method, in 4.0 this wasn't > > required. > > initCore("solrconfig.xml", "schema.xml", "/tmp/my-solr-home"); > > > > > > > > -- > > View this message in context: > > > http://lucene.472066.n3.nabble.com/Anyone-else-see-this-error-when-running-unit-tests-tp4015034p4038472.html > > Sent from the Solr - User mailing list archive at Nabble.com. > > >