I am trying to use the Integration features that now comes with Elasticsearch. So I have my test class annotated with @ClusterScope(scope = Scope.TEST), extending the ElasticsearchIntegrationTest and using the methods createIndex() and Index() to create and index data for testing, but when I run the test I get the following:
java.lang.AssertionError: fix your classpath to have tests-framework.jar before lucene-core.jar
__randomizedtesting.SeedInfo.seed([1B076E861944DDD3]:0)
org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.before(TestRuleSetupAndRestoreClassEnv.java:219)
org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:42)
[...com.carrotsearch.randomizedtesting.]
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:54)
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)
[...com.carrotsearch.randomizedtesting.]
java.lang.Thread.run(Thread.java:745)
in my dependencies; added it and it is still the same. I am running the test as a Junit test from within an IDE (IntelliJ) but the strange thing is the exception pops up randomly. Sometimes it runs without that exception, at most time, it throws it. That is the part I am not clear on what exactly is going on.
java.lang.NoSuchFieldError: LUCENE_4_10_4
at org.elasticsearch.Version.<clinit>(Version.java:226)
at org.elasticsearch.test.ElasticsearchTestCase.<clinit>(ElasticsearchTestCase.java:87)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.carrotsearch.randomizedtesting.RandomizedRunner$1.run(RandomizedRunner.java:562)
Seems the problem was with discrepancies in the elasticsearch and lucene versions. Checked to see the correct version of lucene to use with the version of elasticsearch I am running with, updated, and everything seems to be fine now...I have ran the test aprox. 10 times now and it consistently pass.
I would still be curious to know though, why I was experiencing the random failings when the version was off?
Anyways, thanks for pointing me in the direction of looking into the dependency versions!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.