ElasticSearchIntegrationTest:随机发生的类路径错误

时间:2014-10-15 15:50:58

标签: elasticsearch

我刚刚将一些旧的测试套件从使用本地ElasticSearch集群迁移到扩展ElasticSearchIntegrationTest(如所描述的here)。

@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE)
public class IndexingTestSuite extends ElasticsearchIntegrationTest{
    ...
}

当我在IntelliJ中启动它时,每隔一段时间就会发生以下错误。

有人知道如何解决这个问题吗?

java.lang.AssertionError: fix your classpath to have tests-framework.jar before lucene-core.jar
    at __randomizedtesting.SeedInfo.seed([D0FE9552B361A6B7]:0)
    at org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.before(TestRuleSetupAndRestoreClassEnv.java:202)
    at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
    at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:42)
    at com.carrotsearch.randomizedtesting.rules.SystemPropertiesInvariantRule$1.evaluate(SystemPropertiesInvariantRule.java:55)
    at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:39)
    at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:39)
    at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
    at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:43)
    at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)
    at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)
    at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)
    at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
    at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:360)
    at java.lang.Thread.run(Thread.java:745)

关于类路径问题的消息很清楚,但我没有做任何特别的事情。根据文档,我只添加了以下依赖项:

<dependency>
  <groupId>org.elasticsearch</groupId>
  <artifactId>elasticsearch</artifactId>
  <version>${elasticsearch.version}</version>
  <scope>test</scope>
  <type>test-jar</type>
</dependency>

<dependency>
  <groupId>org.apache.lucene</groupId>
  <artifactId>lucene-test-framework</artifactId>
  <version>${lucene.version}</version>
  <scope>test</scope>
</dependency>

1 个答案:

答案 0 :(得分:0)

依赖项是在我项目的父pom中定义的。

通过将lucene-test-framework依赖项移动到每个子pom(第一个位置)来解决问题。

请参阅here