Skip to content

Commit

Permalink
SNO-96 fix indexing tests (#196)
Browse files Browse the repository at this point in the history
* add max clauses to elasticsearch.yml

* move query for easier debugging

* use local conf/elasticsearch.yml for test fixture
  • Loading branch information
hitz authored May 22, 2019
1 parent 3f5d415 commit 42a3010
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions conf/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cluster.name: elasticsearch_on_travis
discovery.type: single-node
cluster.name: elasticsearch_test_fixture
discovery.type: single-node
indices.query.bool.max_clause_count: 8192
6 changes: 3 additions & 3 deletions src/snovault/elasticsearch/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def get_related_uuids(request, es, updated, renamed):
# beg += BATCH_COUNT
# end += BATCH_COUNT


res = es.search(index=RESOURCES_INDEX, size=SEARCH_MAX, request_timeout=60, body={
query = {
'query': {
'bool': {
'should': [
Expand All @@ -131,7 +130,8 @@ def get_related_uuids(request, es, updated, renamed):
},
},
'_source': False,
})
}
res = es.search(index=RESOURCES_INDEX, size=SEARCH_MAX, request_timeout=60, body=query)

if res['hits']['total'] > SEARCH_MAX:
return (list(all_uuids(request.registry)), True) # guaranteed unique
Expand Down
6 changes: 3 additions & 3 deletions src/snovault/tests/elasticsearch_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def server_process(datadir, host='127.0.0.1', port=9201, prefix='', echo=False):
]
if os.environ.get('TRAVIS'):
print('IN TRAVIS')
echo=True
echo = True
args.append('-Epath.conf=%s/conf' % os.environ['TRAVIS_BUILD_DIR'])
elif os.path.exists('/etc/elasticsearch'):
else:
print('NOT IN TRAVIS')
args.append('-Epath.conf=/etc/elasticsearch')
args.append('-Epath.conf=./conf')
print(args)
process = subprocess.Popen(
args,
Expand Down

0 comments on commit 42a3010

Please sign in to comment.