Skip to content

Commit

Permalink
Merge pull request #42 from 4dn-dcic/test_fixes
Browse files Browse the repository at this point in the history
0.7.5
  • Loading branch information
carlvitzthum authored Jul 23, 2019
2 parents 8bf4b87 + efc6adb commit 554347a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dcicutils/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Version information."""

# The following line *must* be the last in the module, exactly as formatted:
__version__ = "0.7.4"
__version__ = "0.7.5"
5 changes: 1 addition & 4 deletions dcicutils/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def add_log_uuid(logger, log_method, event_dict):


# configure structlog to use its formats for stdlib logging and / or structlog logging
def set_logging(es_server=None, in_prod=False, level=logging.INFO, log_name=None, log_dir=None):
def set_logging(es_server=None, in_prod=False, level=logging.WARN, log_name=None, log_dir=None):
'''
Set logging is a function to be used everywhere, to encourage all subsytems
to generate structured JSON logs, for easy insertion into ES for searching and
Expand Down Expand Up @@ -256,9 +256,6 @@ def set_logging(es_server=None, in_prod=False, level=logging.INFO, log_name=None
'''

# set logging level



# below could be used ot redirect logging to a file if desired
if log_name is None:
log_name = __name__
Expand Down
12 changes: 6 additions & 6 deletions test/test_ff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def test_search_metadata(integrated_ff):

@pytest.mark.integrated
def test_get_search_generator(integrated_ff):
search_url = integrated_ff['ff_key']['server'] + '/search/?type=OntologyTerm'
search_url = integrated_ff['ff_key']['server'] + '/search/?type=FileFastq'
generator1 = ff_utils.get_search_generator(search_url, auth=integrated_ff['ff_key'], page_limit=25)
list_gen1 = list(generator1)
assert len(list_gen1) > 0
Expand All @@ -388,11 +388,11 @@ def test_get_search_generator(integrated_ff):
all_gen2 = [page for pages in list_gen2 for page in pages] # noqa
assert len(all_gen1) == len(all_gen2)
# use a limit in the search
search_url += '&limit=33'
search_url += '&limit=21'
generator3 = ff_utils.get_search_generator(search_url, auth=integrated_ff['ff_key'])
list_gen3 = list(generator3)
all_gen3 = [page for pages in list_gen3 for page in pages] # noqa
assert len(all_gen3) == 33
assert len(all_gen3) == 21
# make sure that all results are unique
all_gen3_uuids = set([item['uuid'] for item in all_gen3])
assert len(all_gen3_uuids) == len(all_gen3)
Expand Down Expand Up @@ -514,8 +514,8 @@ def test_get_es_search_generator(integrated_ff):
es_url = ff_utils.get_health_page(key=integrated_ff['ff_key'])['elasticsearch']
es_client = es_utils.create_es_client(es_url, use_aws_auth=True)
es_query = {'query': {'match_all': {}}, 'sort': [{'_uid': {'order': 'desc'}}]}
# search for all ontology terms with a low pagination size
es_gen = ff_utils.get_es_search_generator(es_client, 'ontology_term',
# search for all fastqs with a low pagination size
es_gen = ff_utils.get_es_search_generator(es_client, 'file_fastq',
es_query, page_size=7)
list_gen = list(es_gen)
assert len(list_gen) > 0
Expand All @@ -526,7 +526,7 @@ def test_get_es_search_generator(integrated_ff):
assert len(page) == 7
all_es_uuids = set([page['_source']['uuid'] for pages in list_gen for page in pages]) # noqa
# make sure all items are unique and len matches ff search
search_res = ff_utils.search_metadata('/search/?type=OntologyTerm&frame=object',
search_res = ff_utils.search_metadata('/search/?type=FileFastq&frame=object',
key=integrated_ff['ff_key'])
search_uuids = set(hit['uuid'] for hit in search_res)
assert all_es_uuids == search_uuids
Expand Down

0 comments on commit 554347a

Please sign in to comment.