-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C4-24 Give ff_utils a lucene API (#58)
* C4-24 first pass at API * C4-24 second pass at API * C4-24 fix flake * C4-24 add test * C4-24 address Kent's points * flake * C4-24 add ability to use generator * QOL change * up test_get_metadata flakiness to 3
- Loading branch information
1 parent
0f16b6e
commit 4781ad5
Showing
5 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
|
||
from dcicutils.es_utils import create_es_client, execute_lucene_query_on_es | ||
|
||
|
||
@pytest.fixture | ||
def es_client_fixture(integrated_ff): | ||
""" Fixture that creates an es client to mastertest """ | ||
return create_es_client(integrated_ff['es_url']) | ||
|
||
|
||
@pytest.mark.integrated | ||
def test_lucene_query_basic(es_client_fixture): | ||
""" Tests basic lucene queries via the underlying endpoint on mastertest """ | ||
results = execute_lucene_query_on_es(client=es_client_fixture, index='fourfront-mastertestuser', query={}) | ||
assert len(results) == 10 | ||
test_query = { | ||
'query': { | ||
'bool': { | ||
'must': [ # search for will's user insert | ||
{'terms': {'_id': ['1a12362f-4eb6-4a9c-8173-776667226988']}} | ||
], | ||
'must_not': [] | ||
} | ||
}, | ||
'sort': [{'_uid': {'order': 'desc'}}] | ||
} | ||
results = execute_lucene_query_on_es(client=es_client_fixture, index='fourfront-mastertestuser', query=test_query) | ||
assert len(results) == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters