The docs
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html for
unit testing have you configuring your pom in a certain way. Apparently
the order of these dependencies matter.
When attempting to use the ElasticsearchIntegrationTest class from a
project managed by gradle, the dependencies section would look something
like this:
dependencies {
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'junit:junit:4.12'
testCompile 'org.elasticsearch:elasticsearch:1.3.4:tests'
testCompile 'org.apache.lucene:lucene-test-framework:4.9.1'
testCompile 'com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.1.11'
compile 'org.elasticsearch:elasticsearch:1.3.4'
}
Unfortunately, classpath order is not guaranteed in this world, and so a simple test with ElasticsearchIntegrationTest fails with:
java.lang.AssertionError: fix your classpath to have tests-framework.jar before lucene-core.jar
__randomizedtesting.SeedInfo.seed([20D50B2CB59AFD95]:0)
org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.before(TestRuleSetupAndRestoreClassEnv.java:177)
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:43)
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)
Do we have a documented story for how to test elasticsearch code with Gradle?
Jon
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/57716599-1b93-4c7a-b254-bc1789703453%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.