Integration testing a native script


(Nick T) #1

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


(David Pilato) #2

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 30 juillet 2014 à 11:31:10, Nick T (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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b2ae43cc-22cd-4d8a-a79d-ddbf2c572750%40googlegroups.com.
For more options, visit 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.
To view this discussion on the web visit 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.


(Thomas) #3

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4b257e79-e424-4573-8f12-81e0a95b27b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Thomas) #4

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7baa9562-58be-4f16-9392-9cf07e4e989d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Nick T) #5

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0d589406-5c0c-450b-b9b6-901d8278c4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6