# Integration Test with elasticsearch

**URL:** <https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599>\
**Category:** Elasticsearch\
**Created:** [September 13, 2013, 7:44pm UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599 "2013-09-13T19:44:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![silvina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/silvina/32/44096_2.png) [@silvina](https://discuss.elastic.co/u/silvina)\
**Post date:** [September 13, 2013, 7:44pm UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599/1 "2013-09-13T19:44:59Z")

</div>

Hi All,  
Is it possible to run elasticsearch in memory (mock) like hsqldb for  
testing purpose?. I want to test elasticsearch but I don't want launch a  
local instance.

Thanks,

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 13, 2013, 8:18pm UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599/2 "2013-09-13T20:18:37Z")

</div>

Elasticsearch's integration tests run in the same JVM as the tests so you might want to look at that. They do save data to disk but in the target directory. I'd suggest having each test try deleting an index before it creates one just to make sure to get a truely fresh copy. Remember to wait for green or yellow status after creating the index or it might not be ready for testing.

Sent from my iPhone

On Sep 13, 2013, at 12:44 PM, anivlis [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:

> Hi All,  
> Is it possible to run elasticsearch in memory (mock) like hsqldb for testing purpose?. I want to test elasticsearch but I don't want launch a local instance.
> 
> Thanks,
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![silvina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/silvina/32/44096_2.png) [@silvina](https://discuss.elastic.co/u/silvina)\
**Post date:** [September 13, 2013, 8:28pm UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599/3 "2013-09-13T20:28:27Z")

</div>

but I need to run elasticsearch.sh before run the test, is that right?

On Fri, Sep 13, 2013 at 5:18 PM, Nik Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:

> Elasticsearch's integration tests run in the same JVM as the tests so you  
> might want to look at that. They do save data to disk but in the target  
> directory. I'd suggest having each test try deleting an index before it  
> creates one just to make sure to get a truely fresh copy. Remember to wait  
> for green or yellow status after creating the index or it might not be  
> ready for testing.
> 
> Sent from my iPhone
> 
> On Sep 13, 2013, at 12:44 PM, anivlis [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:
> 
> Hi All,  
> Is it possible to run elasticsearch in memory (mock) like hsqldb for  
> testing purpose?. I want to test elasticsearch but I don't want launch a  
> local instance.
> 
> Thanks,
> 
> --  
> 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).
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/6kjyy2cq0pM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/6kjyy2cq0pM/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
(\__/)  
(='.'=)  
(")_(")

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 13, 2013, 8:54pm UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599/4 "2013-09-13T20:54:09Z")

</div>

So elasticsearch itself doesn't do that. It run starts elasticsearch in the vm doing the testing. If you are java then you can do that.

Sent from my iPhone

On Sep 13, 2013, at 1:28 PM, silvina [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:

> but I need to run elasticsearch.sh before run the test, is that right?
> 
> On Fri, Sep 13, 2013 at 5:18 PM, Nik Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:
> 
> > Elasticsearch's integration tests run in the same JVM as the tests so you might want to look at that. They do save data to disk but in the target directory. I'd suggest having each test try deleting an index before it creates one just to make sure to get a truely fresh copy. Remember to wait for green or yellow status after creating the index or it might not be ready for testing.
> > 
> > Sent from my iPhone
> > 
> > On Sep 13, 2013, at 12:44 PM, anivlis [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:
> > 
> > > Hi All,  
> > > Is it possible to run elasticsearch in memory (mock) like hsqldb for testing purpose?. I want to test elasticsearch but I don't want launch a local instance.
> > > 
> > > Thanks,
> > > 
> > > --  
> > > 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).
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/6kjyy2cq0pM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/6kjyy2cq0pM/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> (\__/)  
> (='.'=)  
> (")_(")
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 14, 2013, 6:09am UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599/5 "2013-09-14T06:09:43Z")

</div>

Have a look at: [https://github.com/dadoonet/fsriver/blob/master/src/test/java/fr/pilato/elasticsearch/river/fs/AbstractFsRiverTest.java#L67](https://github.com/dadoonet/fsriver/blob/master/src/test/java/fr/pilato/elasticsearch/river/fs/AbstractFsRiverTest.java#L67)

It could help.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 13 sept. 2013 à 22:54, Nik Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) a écrit :

So elasticsearch itself doesn't do that. It run starts elasticsearch in the vm doing the testing. If you are java then you can do that.

Sent from my iPhone

On Sep 13, 2013, at 1:28 PM, silvina [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:

> but I need to run elasticsearch.sh before run the test, is that right?
> 
> On Fri, Sep 13, 2013 at 5:18 PM, Nik Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:
> 
> > Elasticsearch's integration tests run in the same JVM as the tests so you might want to look at that. They do save data to disk but in the target directory. I'd suggest having each test try deleting an index before it creates one just to make sure to get a truely fresh copy. Remember to wait for green or yellow status after creating the index or it might not be ready for testing.
> > 
> > Sent from my iPhone
> > 
> > On Sep 13, 2013, at 12:44 PM, anivlis [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:
> > 
> > > Hi All,  
> > > Is it possible to run elasticsearch in memory (mock) like hsqldb for testing purpose?. I want to test elasticsearch but I don't want launch a local instance.
> > > 
> > > Thanks,
> > > 
> > > --  
> > > 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).
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/6kjyy2cq0pM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/6kjyy2cq0pM/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> (\__/)  
> (='.'=)  
> (")_(")
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).  
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:16am UTC](https://discuss.elastic.co/t/integration-test-with-elasticsearch/13599/6 "2017-07-06T02:16:32Z")

</div>


