Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ dmypy.json

# docker bits
Dockerfile*
docker-compose*
docker-compose*

# Temp files
tmp/
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are generated by the comprehensive query testing, or any output files can go here


8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
- Use locale en_US instead of c.utf-8

### Removed
- Generic fulltext search and tests

## [0.0.19] - 2022-04-15
### Added
- github actions to build `develop`, `pr-x` and released version (e.g. `1.2.3`) Tags
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ shell:
docker-compose run re_api sh

reset:
docker-compose --rmi all -v
docker-compose build
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot "down", and the "build" is redundant since the other make targets do it

docker-compose down --rmi all -v

full_query_testing:
DO_QUERY_TESTING=full time python -m pytest -s $(QUERY_TESTING_FILE)
Expand Down
2 changes: 1 addition & 1 deletion client_src/test/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from uuid import uuid4

from relation_engine_client import REClient
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was confusing since relation_engine_client is a directory with an __init__.py that defined __all__ with main.REClient

from relation_engine_client.main import REClient
from relation_engine_client.exceptions import RERequestError, RENotFound

_API_URL = os.environ.get("RE_API_URL", "http://localhost:5000")
Expand Down
2 changes: 1 addition & 1 deletion relation_engine_server/utils/json_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def resolve_remote(self, uri):

if scheme in self.handlers:
result = self.handlers[scheme](uri)
elif scheme in [u"http", u"https"]:
elif scheme in ["http", "https"]:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autoformatters

# Requests has support for detecting the correct encoding of
# json over http
result = requests.get(uri).json()
Expand Down
2 changes: 1 addition & 1 deletion spec/analyzers/icu_tokenize.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "icu_tokenize",
"type": "text",
"properties": {
"locale": "c.utf-8",
"locale": "en_US",
"accent": false,
"case": "lower",
"stemming": false,
Expand Down
94 changes: 0 additions & 94 deletions spec/stored_queries/generic/fulltext_search.yaml

This file was deleted.

145 changes: 0 additions & 145 deletions spec/test/stored_queries/test_fulltext_search.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
"""
Tests for stored queries involving a fulltext search:
* Generic fulltext_search (should be used with caution because it can be slow and timeout at 60s)
* Taxonomy taxonomy_search_species_strain
* Taxonomy taxonomy_search_species_strain_no_sort

The latter two are switched between depending on the length of the search text.
These stored query tests are all bundled in one test file because their original purpose is to do a species/strain
name search on the ncbi_taxon collection

These tests run within the re_api docker image, and require access to the ArangoDB, auth, and workspace images.
"""
Expand Down Expand Up @@ -251,148 +248,6 @@ def test_prefix_hit(self):
)


class TestFulltextSearchStoredQuery(unittest.TestCase):
Copy link
Copy Markdown
Author

@ghost ghost Apr 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed tests pertaining to now axed spec/stored_queries/generic/fulltext_search.yaml

@classmethod
def setUpClass(cls):
check_spec_test_env()
create_test_docs("ncbi_taxon", ncbi_taxa)

def test_ncbi_taxon_scinames(self):
"""Happy path"""
for sciname in scinames_test_all:
_fulltext_search_query(
self,
coll="ncbi_taxon",
search_attrkey="scientific_name",
search_text=sciname,
ts=_NOW if sciname in scinames_test_latest else None,
filter_attr_expr=[
{"rank": "species"},
{"rank": "strain"},
{"strain": True},
],
offset=None,
limit=LIMIT,
select="scientific_name",
# ---
expect_error=False,
expect_hit=True,
)

def test_null_bind_params(self):
"""Leave off parameters"""
for sciname in scinames_test_all:
_fulltext_search_query(
self,
coll="ncbi_taxon",
search_attrkey="scientific_name",
search_text=sciname,
ts=None,
filter_attr_expr=None,
offset=None,
limit=None,
select=None,
# ---
expect_error=False,
expect_hit=True,
)

def test_fully_specified_bind_params(self):
"""Specify all parameters"""
for sciname in scinames_test_all:
_fulltext_search_query(
self,
coll="ncbi_taxon",
search_attrkey="scientific_name",
search_text=sciname,
ts=_NOW if sciname in scinames_test_latest else None,
filter_attr_expr=[
{"rank": "species"},
{"rank": "strain"},
{"strain": True},
],
offset=0,
limit=LIMIT,
select=["id", "scientific_name"],
# ---
expect_error=False,
expect_hit=True,
)

def test_extra_params(self):
"""Extra params not in spec/aql"""
_fulltext_search_query(
self,
coll="ncbi_taxon",
search_attrkey="scientific_name",
search_text="esch",
ts=None,
filter_attr_expr=[
{"rank": "species"},
{"rank": "strain"},
{"strain": True},
],
offset=0,
limit=LIMIT,
select=["id", "scientific_name"],
extra_unused_param=42,
# ---
expect_error=("Additional properties are not allowed"),
)

def test_validation_fail(self):
_fulltext_search_query(
self,
coll=[],
search_attrkey=42,
search_text={"hi": 1},
ts=None,
filter_attr_expr=None,
offset=None,
limit=None,
select=None,
# ---
expect_error="[] is not of type 'string'",
)

def test_aql_error(self):
for sciname in scinames_test_all:
_fulltext_search_query(
self,
coll="ncbi_taxon",
search_attrkey="fake_attrkey",
search_text=sciname,
ts=None,
filter_attr_expr=None,
offset=None,
limit=None,
select=None,
# ---
expect_error=True,
)

def test_no_hit(self):
for sciname in scinames_test_all:
_fulltext_search_query(
self,
coll="ncbi_taxon",
search_attrkey="scientific_name",
search_text=sciname[::-1],
ts=None,
filter_attr_expr=None,
offset=None,
limit=None,
select=None,
# ---
expect_error=False,
expect_hit=False,
expected_hits=[],
)


# --- Test helpers ---


def _switch_taxonomy_search_species_strain_queries(search_text):
return (
"taxonomy_search_species_strain_no_sort"
Expand Down