Skip to content

Commit

Permalink
Merge pull request #6711 from stsewd/easy-run-search-tests-docker
Browse files Browse the repository at this point in the history
Make easy to run search tests in docker compose
  • Loading branch information
ericholscher authored Mar 3, 2020
2 parents 57a4f31 + 1c756d1 commit 820c857
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ python:
- 3.6
dist: xenial

addons:
hosts:
- search

jobs:
include:
- python: 3.6
Expand Down
3 changes: 3 additions & 0 deletions docs/development/search.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Local Development Configuration

Installing and running Elasticsearch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You need to install and run Elasticsearch_ version 6.3 on your local development machine.
You can get the installation instructions
`here <https://www.elastic.co/guide/en/elasticsearch/reference/6.3/install-elasticsearch.html>`_.
Expand All @@ -20,6 +21,8 @@ Otherwise, you can also start an Elasticsearch Docker container by running the f
-e "discovery.type=single-node" \
docker.elastic.co/elasticsearch/elasticsearch:6.3.2

You need to override the ``ES_HOSTS`` and ``ELASTICSEARCH_DSL`` settings to point to ``127.0.0.1:9200``.

Indexing into Elasticsearch
^^^^^^^^^^^^^^^^^^^^^^^^^^^
For using search, you need to index data to the Elasticsearch Index. Run ``reindex_elasticsearch``
Expand Down
2 changes: 0 additions & 2 deletions docs/development/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ you can also set the ``TOX_POSARGS`` environment variable to an empty string::
.. warning::

Running tests for search needs an Elasticsearch :ref:`instance running locally <development/search:Installing and running Elasticsearch>`.
If you are testing inside :ref:`docker compose <development/standards:Working with Docker Compose>`,
you'll need to override the ``ES_HOSTS`` and ``ELASTICSEARCH_DSL`` settings to point to ``search:9200`` instead.

To target a specific environment::

Expand Down
4 changes: 2 additions & 2 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ def USE_PROMOS(self): # noqa
ALLOW_ADMIN = True

# Elasticsearch settings.
ES_HOSTS = ['127.0.0.1:9200']
ES_HOSTS = ['search:9200']
ELASTICSEARCH_DSL = {
'default': {
'hosts': '127.0.0.1:9200'
'hosts': 'search:9200'
},
}
# Chunk size for elasticsearch reindex celery tasks
Expand Down
5 changes: 0 additions & 5 deletions readthedocs/settings/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class DockerBaseSettings(CommunityDevSettings):

# Enable auto syncing elasticsearch documents
ELASTICSEARCH_DSL_AUTOSYNC = True if 'SEARCH' in os.environ else False
ELASTICSEARCH_DSL = {
'default': {
'hosts': 'search:9200',
},
}

RTD_CLEAN_AFTER_BUILD = True

Expand Down

0 comments on commit 820c857

Please sign in to comment.