Elasticsearch 5.1.1 simple integration test hangs running gradle test


(James Truty) #1

Following the docs and just extending ESIntegTestCase with one noop @Test, gradle test hangs for me after running a single test. I am using gradle 2.13. Running a thread dump on the gradle process is not helpful.


(Daniel Mitterdorfer) #2

Hi @jtruty,

can you add the following test to the Elasticsearch core subproject and run it with gradle :core:integTest -Dtests.class=org.elasticsearch.ScratchIT?

package org.elasticsearch;

import org.elasticsearch.test.ESIntegTestCase;
import org.junit.Test;

public class ScratchIT extends ESIntegTestCase {
    @Test
    public void foo() {
        assertTrue(true);
    }
}

This worked fine on my machine (i.e. the build finished).

A couple of further suggestions:

  • You should add @ClusterScope on your test class to have more fine-grained control
  • By convention we prefix test methods with test instead of using @Test.
  • Gradle forks new processes so you need to find the affected process with jps -v first and then initiate a thread dump.

Daniel


(James Truty) #3

I actually got it working by disabling the security manager in the gradle test task directly - passing it in via command line apparently does not work out of the box:

test {
    jvmArgs '-Dtests.security.manager=false'
}

To avoid a JarHell exception, I had to remove the hamcrest dependency from junit. Here is my dependency test block:

testCompile (group: 'junit', name: 'junit', version: '4.11') {
    exclude group:'org.hamcrest' //also included in es test framework
}
testCompile "org.elasticsearch.test:framework:$esVersion"
testCompile "org.apache.lucene:lucene-test-framework:$luceneVersion"

In addition, there are a few directories required to exist in the build directory: src/main/resources and test/main/resources must have at least one file to be created.
With all of this, I can run tests extending ESIntegTestCase.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.