# Help with ESIntegTestCase

**URL:** <https://discuss.elastic.co/t/help-with-esintegtestcase/105245>\
**Category:** Elasticsearch\
**Created:** [October 25, 2017, 12:51pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245 "2017-10-25T12:51:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [October 25, 2017, 12:51pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/1 "2017-10-25T12:51:31Z")

</div>

So I have Developed a Security plugin and wish to test it using a cluster started via ESIntegTestCase. But whenever I call "getRestClient()" from within my class, I get :-

> Throwable #1: java.lang.IllegalArgumentException: no hosts provided  
> at \_\_randomizedtesting.SeedInfo.seed([794D93C46E1791F4:37B4693F7BCC51CE]:0)  
> at org.elasticsearch.client.RestClientBuilder.(RestClientBuilder.java:67)  
> at org.elasticsearch.client.RestClient.builder(RestClient.java:117)

Perhaps there is not Data node present? I've seen that it never gets inside  
[if (node.getHttp() != null) {](https://github.com/elastic/elasticsearch/blob/master/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java#L2164)

I assume I'm configure it wrong? I'm using :-  
@ESIntegTestCase.ClusterScope(scope=ESIntegTestCase.Scope.SUITE, numDataNodes=3)  
public class AuthenticatePluginIntegrationTest extends ESIntegTestCase {  
Can somebody guide me?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [October 25, 2017, 1:37pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/2 "2017-10-25T13:37:06Z")

</div>

Nodes created by ESIntegTestCase do not have http enabled by default. You will need to override the node settings and set that. See `nodeSettings(int nodeOrdinal)` method on ESIntegTestCase, and the `http.enabled` setting. However, a much better method of doing these types of tests is to stand up a real ES cluster (even if single node). If you use the provided ES gradle plugin, this is done automatically for you with the `integTest` task. If you use maven, see[this blog post from last year](http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/) on how to accomplish this.

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [October 25, 2017, 2:04pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/3 "2017-10-25T14:04:34Z")

</div>

Setting http.enabled to true leads to this error : (Even If i don't call for REST Client)

> Throwable #1: java.lang.IllegalStateException: Unsupported http.type   
> at org.elasticsearch.common.network.NetworkModule.getHttpServerTransportSupplier(NetworkModule.java:195)  
> at org.elasticsearch.node.Node.(Node.java:429)  
> at org.elasticsearch.node.MockNode.(MockNode.java:60)  
> at org.elasticsearch.test.InternalTestCluster.buildNode(InternalTestCluster.java:622)  
> at org.elasticsearch.test.InternalTestCluster.reset(InternalTestCluster.java:1044)  
> at org.elasticsearch.test.InternalTestCluster.beforeTest(InternalTestCluster.java:992)  
> at org.elasticsearch.test.ESIntegTestCase.beforeInternal(ESIntegTestCase.java:367)  
> at org.elasticsearch.test.ESIntegTestCase.setupTestCluster(ESIntegTestCase.java:2037)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.lang.reflect.Method.invoke(Method.java:498)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1713)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:941)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:957)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)  
> at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)  
> at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)  
> at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)  
> at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)  
> at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)  
> at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:916)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:802)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:852)  
> at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:863)  
> at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)  
> at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)  
> at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)  
> at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)  
> at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)  
> at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)  
> at java.lang.Thread.run(Thread.java:748)

Out of curiosity, why is there a getRestClient() if http is not enabled by default?  
On top of it, in TransportClient:

```
Client client = client().filterWithHeader(Collections.singletonMap("Authorization", "Basic " +
        "Base64 Of username:password" ));
//Then using this new client variable to make calls.

```

OR

```
client().threadPool().getThreadContext().putHeader("Authorization",
    "Basic " + "Base64 Of username:password" );

```

Is Having no effect whatsoever, any idea?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [October 25, 2017, 2:23pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/4 "2017-10-25T14:23:52Z")

</div>

You don't have any http transport implementations. In ES, this is provided by the netty4 module. However, this is not available in tests. You will need to choose and set an implementation. You can call `getTestTransportType()` to get a randomized implementation (which chooses between the test nio implementation or a mock tcp implementation).

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [October 25, 2017, 2:32pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/5 "2017-10-25T14:32:16Z")

</div>

Sorry to bother you again, do you have any idea why channelType in TransportChannel is 'local' for client() ? Can this be changed somehow?  
Doesn't ESIntegTestCase calls getTestTransportType()? [https://github.com/elastic/elasticsearch/blob/master/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java#L1823](https://github.com/elastic/elasticsearch/blob/master/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java#L1823)  
Btw it only exists from 6.x, I'm using 5.4 and 5.6.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [October 25, 2017, 3:36pm UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/6 "2017-10-25T15:36:24Z")

</div>

For 5.x, see the `reindex` module for an example of how to enable http. I believe you will need to add a test dependency on the netty4 module.

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [November 7, 2017, 9:58am UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/7 "2017-11-07T09:58:06Z")

</div>

Could you provide me with some reference/source for ES gradle plugin? I'm unable to get it to work [Gradle Project].

---

<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:** [December 5, 2017, 9:58am UTC](https://discuss.elastic.co/t/help-with-esintegtestcase/105245/8 "2017-12-05T09:58:43Z")

</div>

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