Repository: ClearcodeHQ/pytest-elasticsearch (language: python)

Issue:
Runtime Error - does not point to elasticsearch
### I am testing using pytest-elastic search. This is my code structure 
```import pytest
from pytest_elasticsearch import factories

elasticsearch_my_proc = factories.elasticsearch_proc(port=9600)
elasticsearch_my = factories.elasticsearch('elasticsearch_my_proc')

class TestSuccessResponses:
    def test_es(self, elasticsearch_my_proc):
        assert elasticsearch_my_proc.running == True```

I am getting this error 
```                )
E               RuntimeError: '/usr/share/elasticsearch/bin/elasticsearch' does not point to elasticsearch.

venv/lib/python3.8/site-packages/pytest_elasticsearch/executor.py:101: RuntimeError
=========================================================== short test summary info ===========================================================
ERROR tests/test_es.py::TestSuccessResponses::test_es - RuntimeError: '/usr/share/elasticsearch/bin/elasticsearch' does not point to elastic... ```
Runtime Error - does not point to elasticsearch
### I am testing using pytest-elastic search. This is my code structure 
```import pytest
from pytest_elasticsearch import factories

elasticsearch_my_proc = factories.elasticsearch_proc(port=9600)
elasticsearch_my = factories.elasticsearch('elasticsearch_my_proc')

class TestSuccessResponses:
    def test_es(self, elasticsearch_my_proc):
        assert elasticsearch_my_proc.running == True```

I am getting this error 
```                )
E               RuntimeError: '/usr/share/elasticsearch/bin/elasticsearch' does not point to elasticsearch.

venv/lib/python3.8/site-packages/pytest_elasticsearch/executor.py:101: RuntimeError
=========================================================== short test summary info ===========================================================
ERROR tests/test_es.py::TestSuccessResponses::test_es - RuntimeError: '/usr/share/elasticsearch/bin/elasticsearch' does not point to elastic... ```


Discussion / hints:
@ankitaghosh2492-developer pass proper executable parameter to elasticsearch_proc, I see it's missing from package configuration, but you can change it directly when you're using elasticsearch_proc https://github.com/ClearcodeHQ/pytest-elasticsearch/blob/master/src/pytest_elasticsearch/factories.py#L50
Is it correct that I can't change the executable path if I just want to use the pre-defined `elasticsearch` fixture? (On a Mac, it's `/usr/local/bin/elasticsearch`.) If this is the case, what is the most straightforward way to create a fixture pointing to the right executable that gets recreated for every test? Just like the default `elasticsearch` fixture would do?
@konstantinmiller should be enough to add in your top-level conftest.py file this:

``` python
elasticsearch_proc = factories.elasticsearch_proc("/usr/local/bin/elasticsearch")
```

I'd accept a pull request adding configuration option for executable though :)
@fizyk I am interested in adding this option. I will keep you posted and send a merge request.
@ankitaghosh2492-developer pass proper executable parameter to elasticsearch_proc, I see it's missing from package configuration, but you can change it directly when you're using elasticsearch_proc https://github.com/ClearcodeHQ/pytest-elasticsearch/blob/master/src/pytest_elasticsearch/factories.py#L50
Is it correct that I can't change the executable path if I just want to use the pre-defined `elasticsearch` fixture? (On a Mac, it's `/usr/local/bin/elasticsearch`.) If this is the case, what is the most straightforward way to create a fixture pointing to the right executable that gets recreated for every test? Just like the default `elasticsearch` fixture would do?
@konstantinmiller should be enough to add in your top-level conftest.py file this:

``` python
elasticsearch_proc = factories.elasticsearch_proc("/usr/local/bin/elasticsearch")
```

I'd accept a pull request adding configuration option for executable though :)
@fizyk I am interested in adding this option. I will keep you posted and send a merge request.

Fix patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index edb47d5e..39ff41d9 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,8 +4,15 @@ CHANGELOG
 unreleased
 -------
 
-- [bugfix] Handle properly elasticsearch versions with two-digit minor version
+Features
+++++++++
 
+- Add command line and ini configuration option for the executable.
+
+Bugfix
+++++++
+
+- Handle properly elasticsearch versions with two-digit minor version
 
 2.0.1
 -------
diff --git a/README.rst b/README.rst
index aa12c341..202e6a52 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,4 @@
+
 .. image:: https://raw.githubusercontent.com/ClearcodeHQ/pytest-elasticsearch/master/logo.png
     :width: 100px
     :height: 100px
@@ -105,6 +106,12 @@ You can pick which you prefer, but remember that these settings are handled in t
      - pytest.ini option
      - Noop process fixture
      - Default
+   * - Elasticsearch executable
+     - executable
+     - --elasticsearch_executable
+     - elasticsearch_executable
+     -
+     - /usr/share/elasticsearch/bin/elasticsearch
    * - logs directory
      - logsdir
      - --elasticsearch-logsdir


Test patch:
diff --git a/src/pytest_elasticsearch/factories.py b/src/pytest_elasticsearch/factories.py
index 216bf6b8..37f997db 100644
--- a/src/pytest_elasticsearch/factories.py
+++ b/src/pytest_elasticsearch/factories.py
@@ -37,7 +37,7 @@ def return_config(request):
     options = [
         'port', 'transport_tcp_port', 'host', 'cluster_name',
         'network_publish_host',
-        'index_store_type', 'logs_prefix', 'logsdir'
+        'index_store_type', 'logs_prefix', 'logsdir', 'executable'
     ]
     for option in options:
         option_name = 'elasticsearch_' + option
@@ -47,11 +47,12 @@ def return_config(request):
     return config
 
 
-def elasticsearch_proc(executable='/usr/share/elasticsearch/bin/elasticsearch',
+def elasticsearch_proc(executable=None,
                        host=None, port=-1, transport_tcp_port=None,
                        cluster_name=None, network_publish_host=None,
                        index_store_type=None, logs_prefix=None,
                        elasticsearch_logsdir=None):
+
     """
     Create elasticsearch process fixture.
 
@@ -83,6 +84,7 @@ def elasticsearch_proc_fixture(request):
         """Elasticsearch process starting fixture."""
         config = return_config(request)
         elasticsearch_host = host or config['host']
+        elasticsearch_executable = executable or config['executable']
 
         elasticsearch_port = get_port(port) or get_port(config['port'])
         elasticsearch_transport_port = get_port(transport_tcp_port) or \
@@ -110,7 +112,7 @@ def elasticsearch_proc_fixture(request):
             gettempdir(), 'elasticsearch_{0}_tmp'.format(elasticsearch_port))
 
         elasticsearch_executor = ElasticSearchExecutor(
-            executable,
+            elasticsearch_executable,
             elasticsearch_host,
             elasticsearch_port,
             elasticsearch_transport_port,
diff --git a/src/pytest_elasticsearch/plugin.py b/src/pytest_elasticsearch/plugin.py
index 74374cac..bfc387cf 100644
--- a/src/pytest_elasticsearch/plugin.py
+++ b/src/pytest_elasticsearch/plugin.py
@@ -24,6 +24,7 @@
 # pylint:disable=invalid-name
 _help_logsdir = 'Elasticsearch logs directory'
 _help_host = 'Elasticsearch host'
+_help_executable = 'Elasticsearch executable'
 _help_port = 'Elasticsearch port'
 _help_cluster_name = 'Cluster name of the elasticsearch process fixture'
 _help_index_store_type = \
@@ -49,6 +50,12 @@ def pytest_addoption(parser):
         default='127.0.0.1'
     )
 
+    parser.addini(
+        name='elasticsearch_executable',
+        help=_help_executable,
+        default='/usr/share/elasticsearch/bin/elasticsearch'
+    )
+
     parser.addini(
         name='elasticsearch_cluster_name',
         help=_help_cluster_name,
@@ -68,8 +75,7 @@ def pytest_addoption(parser):
     )
 
     parser.addini(
-        name='elasticsearch_logs_prefix',
-        help=_help_logs_prefix,
+        name='elasticsearch_logs_prefix', help=_help_logs_prefix,
         default=''
     )
 
@@ -100,6 +106,13 @@ def pytest_addoption(parser):
         help=_help_host,
     )
 
+    parser.addoption(
+        '--elasticsearch_executable',
+        action='store',
+        dest='elasticsearch_executable',
+        help=_help_executable,
+    )
+
     parser.addoption(
         '--elasticsearch-cluster-name',
         action='store',