Skip to content
Merged

D->M #128

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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/

7 changes: 6 additions & 1 deletion .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Relation Engine test and deploy
on:
[push, pull_request]
pull_request:
types:
- opened
- synchronize
- ready_for_review

jobs:
run_tests:
runs-on: ubuntu-latest
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ 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).

## [0.0.19] - 2022-04-15
## [0.0.20] 2022-05-17
### Changed
- Use locale en_US instead of c.utf-8
- Upgrade to image arangodb:3.9

## [0.0.19] - 2022-05-02
### Added
- github actions to build `develop`, `pr-x` and released version (e.g. `1.2.3`) Tags
- instructions for how to release to production

### Removed
- Generic fulltext search and tests

## [0.0.18] - 2022-03-02
### Added
- taxonomy_search_species_strain and taxonomy_search_species_strain_no_sort stored queries
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
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 VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.19
0.0.20
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
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 docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ services:

# Arangodb server in cluster mode
arangodb:
image: arangodb:3.5
image: arangodb:3.9
ports:
- "127.0.0.1:8529:8529"
command: sh -c "arangodb --starter.local"
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"]:
# 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):
@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