Re: Anyone else see this error when running unit tests?

2013-02-14 Thread Amit Nithian
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

"

 

 " section


   

  org.apache.maven.plugins

  maven-surefire-plugin

  2.13

  

   -Dtests.codec=Lucene40

  

  


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  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"  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.
> >
>


Re: Anyone else see this error when running unit tests?

2013-02-04 Thread Roman Chyla
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"  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.
>


Re: Anyone else see this error when running unit tests?

2013-02-04 Thread Mike Schultz
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.


Re: Anyone else see this error when running unit tests?

2013-02-01 Thread Jan Morlock
Hi Amit,

I experienced the same problem. According to

http://maven.apache.org/surefire/maven-surefire-plugin/examples/configuring-classpath.html

there is a certain classpath ordering for unittests favoring project
dependencies. Therefore by explicitly specifying the lucene-test-framework
as such a dependency inside the pom.xml, it should appear before
lucene-core.jar:


org.apache.lucene
lucene-test-framework
4.1.0
test


In my case, this fixed the problem.
Best regards
Jan



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Anyone-else-see-this-error-when-running-unit-tests-tp4015034p4038039.html
Sent from the Solr - User mailing list archive at Nabble.com.