# Unable to seed data only once with ElasticsearchIntegrationTest

**URL:** <https://discuss.elastic.co/t/unable-to-seed-data-only-once-with-elasticsearchintegrationtest/20554>\
**Category:** Elasticsearch\
**Created:** [November 4, 2014, 10:30am UTC](https://discuss.elastic.co/t/unable-to-seed-data-only-once-with-elasticsearchintegrationtest/20554 "2014-11-04T10:30:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurent\_T](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laurent_t/32/1133_2.png) [@Laurent\_T](https://discuss.elastic.co/u/Laurent_T)\
**Post date:** [November 4, 2014, 10:30am UTC](https://discuss.elastic.co/t/unable-to-seed-data-only-once-with-elasticsearchintegrationtest/20554/1 "2014-11-04T10:30:10Z")

</div>

Hi,

I've just given a try to ElasticsearchIntegrationTest as I used to create  
my own local node with some pre-seeded data  
It seems nice but I'm unable to reproduce what I had setting up my own node.

I've defined my PluginTest class as following:

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

I use to have a singleton that seeded my data upong @BeforeClass. It seems  
I can't do that anymore because no cluster is available after  
ElasticsearchIntegrationTest.beforeClass()  
It only becomes available in @Before.

The documentation of ElasticsearchIntegrationTest  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/integration-tests.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/integration-tests.html) did  
not really help me to define how I would manage test seeds.  
I've tried to store the client and seed the data once based on a static  
variable in my @Before like this:

private static Injector injector;  
private static Plugin action;  
private static TestClient esClient;  
@Before  
public void beforePluginTest() {  
if (injector == null) {  
injector = Guice.createInjector(new TestModule(client())); // this is the  
google guice injector, not the es one

esClient = injector.getInstance(TestClient.class); // this seeds the data  
and gives some helper methods  
action = injector.getInstance(Plugin.class); // this is my plugin  
}  
}

But then i get the following error for some tests:  
org.elasticsearch.client.transport.NoNodeAvailableException: None of the  
configured nodes are available: []

I also see that for each test, nodes are started/stopped which takes an  
awful lot of time. I would like only one local node in which I seed my data  
once. I could then i execute all my tests and uppon completion of those the  
node and it's data are closed / destroyed.

Does anyone have some pointers to help me on this ?

Thanks  
Regards,  
Laurent

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3664831f-17d0-4b89-bee2-48abe563e390%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3664831f-17d0-4b89-bee2-48abe563e390%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:52am UTC](https://discuss.elastic.co/t/unable-to-seed-data-only-once-with-elasticsearchintegrationtest/20554/2 "2017-07-06T00:52:18Z")

</div>

Closed on July 6, 2017, 12:52am UTC


