# Integration testing a native script

**URL:** <https://discuss.elastic.co/t/integration-testing-a-native-script/18972>\
**Category:** Elasticsearch\
**Created:** [July 30, 2014, 9:31am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972 "2014-07-30T09:31:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_T](https://avatars.discourse-cdn.com/v4/letter/n/977dab/32.png) [@Nick\_T](https://discuss.elastic.co/u/Nick_T)\
**Post date:** [July 30, 2014, 9:31am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972/1 "2014-07-30T09:31:06Z")

</div>

Is there a way to have a native java script accessible in integration  
tests? In my integration tests I am creating a test node in the /tmp  
folder.

I've tried copying the script to /tmp/plugins/scripts but that was quite  
hopeful and unfortunately does not work.

Desperate for help.

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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b2ae43cc-22cd-4d8a-a79d-ddbf2c572750%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b2ae43cc-22cd-4d8a-a79d-ddbf2c572750%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 30, 2014, 9:37am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972/2 "2014-07-30T09:37:45Z")

</div>

I might be wrong but I think that scripts should be located in config/scripts, right?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 30 juillet 2014 à 11:31:10, Nick T ([nttodo22@gmail.com](mailto:nttodo22@gmail.com)) a écrit:

Is there a way to have a native java script accessible in integration tests? In my integration tests I am creating a test node in the /tmp folder.

I've tried copying the script to /tmp/plugins/scripts but that was quite hopeful and unfortunately does not work.

Desperate for help.

## 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b2ae43cc-22cd-4d8a-a79d-ddbf2c572750%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b2ae43cc-22cd-4d8a-a79d-ddbf2c572750%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/etPan.53d8bce9.8138641.f0d0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53d8bce9.8138641.f0d0%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)\
**Post date:** [July 30, 2014, 10:30am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972/3 "2014-07-30T10:30:05Z")

</div>

Hi,

I have tried the same approach and it worked for me, meaning to copy the  
script I want to perform an integration test and run my IT.

I do the following steps

1. Setup the required paths for elasticsearch

final Settings settings  
= settingsBuilder()  
.put("http.enabled", "true")  
.put("path.conf", confDir)  
.put("path.data", dataDir)  
.put("path.work", workDir)  
.put("path.logs", logsDir)  
....

1. copy your scripts to the appropriate location
2. fire up a local node  
node =  
nodeBuilder().local(true).settings(settings).clusterName(nodeName).node();  
node.start();

Maybe you first start the node and then add the script, this might not work  
because i think es does a per minute scan for new scripts and the IT test  
does not allow this to happen, hence you should first copy your script and  
then start the node

Hope it helps

Thomas

On Wednesday, 30 July 2014 12:31:06 UTC+3, Nick T wrote:

> Is there a way to have a native java script accessible in integration  
> tests? In my integration tests I am creating a test node in the /tmp  
> folder.
> 
> I've tried copying the script to /tmp/plugins/scripts but that was quite  
> hopeful and unfortunately does not work.
> 
> Desperate for help.
> 
> 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4b257e79-e424-4573-8f12-81e0a95b27b4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4b257e79-e424-4573-8f12-81e0a95b27b4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)\
**Post date:** [July 30, 2014, 10:33am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972/4 "2014-07-30T10:33:45Z")

</div>

I have noticed that you mention native java script so you have implemented  
it as a plugin?  
if so try the following in your settings:  
final Settings settings  
= settingsBuilder()  
...

```
            .put("plugin.types", YourPlugin.class.getName())

```

Thomas

On Wednesday, 30 July 2014 12:31:06 UTC+3, Nick T wrote:

> Is there a way to have a native java script accessible in integration  
> tests? In my integration tests I am creating a test node in the /tmp  
> folder.
> 
> I've tried copying the script to /tmp/plugins/scripts but that was quite  
> hopeful and unfortunately does not work.
> 
> Desperate for help.
> 
> 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7baa9562-58be-4f16-9392-9cf07e4e989d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7baa9562-58be-4f16-9392-9cf07e4e989d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Nick\_T](https://avatars.discourse-cdn.com/v4/letter/n/977dab/32.png) [@Nick\_T](https://discuss.elastic.co/u/Nick_T)\
**Post date:** [July 31, 2014, 9:13am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972/5 "2014-07-31T09:13:03Z")

</div>

Thanks for the help.

My working solution is:

1. Create the plugins/scripts directory created in /tmp for each test node
2. copy my script jar into it
3. Register script in settings:  
.put("script.native.NAME.type", "NAME OF SCRIPT")

I am super grateful for all your help. Btw, I wasn't creating it as a  
plugin.

On Wednesday, 30 July 2014 11:33:45 UTC+1, Thomas wrote:

> I have noticed that you mention native java script so you have implemented  
> it as a plugin?  
> if so try the following in your settings:  
> final Settings settings  
> = settingsBuilder()  
> ...
> 
> ```
> .put("plugin.types", YourPlugin.class.getName())
> 
> ```
> 
> Thomas
> 
> On Wednesday, 30 July 2014 12:31:06 UTC+3, Nick T wrote:
> 
> > Is there a way to have a native java script accessible in integration  
> > tests? In my integration tests I am creating a test node in the /tmp  
> > folder.
> > 
> > I've tried copying the script to /tmp/plugins/scripts but that was quite  
> > hopeful and unfortunately does not work.
> > 
> > Desperate for help.
> > 
> > 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0d589406-5c0c-450b-b9b6-901d8278c4dd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0d589406-5c0c-450b-b9b6-901d8278c4dd%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, 1:12am UTC](https://discuss.elastic.co/t/integration-testing-a-native-script/18972/6 "2017-07-06T01:12:01Z")

</div>


