Skip to content

Commit 6c430e5

Browse files
committed
fixing search install plugin
1 parent b8f1a06 commit 6c430e5

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

readthedocs/search/tests/conftest.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from random import shuffle
44

55
import pytest
6+
from django.core.management import call_command
67
from django_dynamic_fixture import G
78

89
from readthedocs.projects.models import Project
@@ -17,26 +18,15 @@ def mock_elastic_index(mocker):
1718

1819

1920
@pytest.fixture()
20-
def es_index(mock_elastic_index):
21-
# Create the index.
22-
index = Index()
23-
index_name = index.timestamped_index()
24-
index.create_index(index_name)
25-
index.update_aliases(index_name)
26-
# Update mapping
27-
proj = ProjectIndex()
28-
proj.put_mapping()
29-
page = PageIndex()
30-
page.put_mapping()
31-
sec = SectionIndex()
32-
sec.put_mapping()
33-
34-
yield index
35-
index.delete_index(index_name=index_name)
21+
def es_index():
22+
call_command('search_index', '--create')
23+
24+
yield
25+
call_command('search_index', '--delete')
3626

3727

3828
@pytest.fixture
39-
def all_projects():
29+
def all_projects(es_index):
4030
projects = [G(Project, slug=project_slug, name=project_slug) for project_slug in ALL_PROJECTS]
4131
shuffle(projects)
4232
return projects

readthedocs/search/tests/test_views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def _get_search_result(self, url, client, search_params):
2828
result = page.find('.module-list-wrapper .module-item-title')
2929
return result, page
3030

31+
32+
3133
# TODO: Implement a way to generate unique index name in test
3234
# @pytest.fixture(autouse=True)
3335
# def mock_project_index(self, mocker):

scripts/travis/install_elasticsearch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ if [ $ES_DOWNLOAD_URL ]
22
then
33
wget ${ES_DOWNLOAD_URL}
44
tar -xzf elasticsearch-${ES_VERSION}.tar.gz
5+
./elasticsearch-${ES_VERSION}/bin/elasticsearch-plugin install analysis-icu
56
./elasticsearch-${ES_VERSION}/bin/elasticsearch &
67
fi

0 commit comments

Comments
 (0)