# Elasticsearch 5.1.1 simple integration test hangs running gradle test

**URL:** <https://discuss.elastic.co/t/elasticsearch-5-1-1-simple-integration-test-hangs-running-gradle-test/70485>\
**Category:** Elasticsearch\
**Created:** [January 3, 2017, 9:58pm UTC](https://discuss.elastic.co/t/elasticsearch-5-1-1-simple-integration-test-hangs-running-gradle-test/70485 "2017-01-03T21:58:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtruty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jtruty/32/14282_2.png) [@jtruty](https://discuss.elastic.co/u/jtruty)\
**Post date:** [January 3, 2017, 9:58pm UTC](https://discuss.elastic.co/t/elasticsearch-5-1-1-simple-integration-test-hangs-running-gradle-test/70485/1 "2017-01-03T21:58:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [January 5, 2017, 12:01pm UTC](https://discuss.elastic.co/t/elasticsearch-5-1-1-simple-integration-test-hangs-running-gradle-test/70485/2 "2017-01-05T12:01:38Z")

</div>

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`?

```auto
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

---

<div class="post-metadata">

**Author:** ![jtruty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jtruty/32/14282_2.png) [@jtruty](https://discuss.elastic.co/u/jtruty)\
**Post date:** [January 5, 2017, 2:48pm UTC](https://discuss.elastic.co/t/elasticsearch-5-1-1-simple-integration-test-hangs-running-gradle-test/70485/3 "2017-01-05T14:48:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 2, 2017, 2:49pm UTC](https://discuss.elastic.co/t/elasticsearch-5-1-1-simple-integration-test-hangs-running-gradle-test/70485/4 "2017-02-02T14:49:03Z")

</div>

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