Skip to content

Commit

Permalink
Merge branch 'main' into 398-adapt-search-query-filter-and-scoring-to-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
VKTB committed Feb 24, 2023
2 parents 5b9db5e + dd73f90 commit d47a45d
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 58 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
run: poetry run python -m util.icat_db_generator
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of dummy data to be prepared
- name: Get SQL dump of dummy data
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_1.sql

# Drop and re-create icatdb to remove generated data
Expand All @@ -306,6 +306,9 @@ jobs:
- name: Reinstall ICAT Server
run: cd /home/runner/install/icat.server; ./setup -vv install

- name: Add ICAT 5 triggers
run: cd /home/runner/install/icat.server; sudo mysql -uroot -D icatdb < create_triggers_mysql_5_0.sql

- name: Add (new) dummy data to icatdb
run: |
cd /home/runner/work/datagateway-api/datagateway-api; poetry run python -m util.icat_db_generator
Expand All @@ -326,6 +329,8 @@ jobs:
# Regenerate table structure of icatdb
- name: Reinstall ICAT Server
run: cd /home/runner/install/icat.server; ./setup -vv install
- name: Add ICAT 5 triggers
run: cd /home/runner/install/icat.server; sudo mysql -uroot -D icatdb < create_triggers_mysql_5_0.sql

- name: Checkout DataGateway API (default branch)
uses: actions/checkout@v2
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

<!--next-version-placeholder-->

## v6.3.2 (2023-02-24)
### Fix
* Add triggers for later stages of consistency test ([`2d7d677`](https://github.com/ral-facilities/datagateway-api/commit/2d7d677fbab85a93fb36fc12afb434ba74dbfc27))

## v6.3.1 (2023-02-23)
### Fix
* Remove dataset filesize generator ([`fb466dd`](https://github.com/ral-facilities/datagateway-api/commit/fb466dd6012088fb25f575f3c7198a9d7d28e070))

## v6.3.0 (2023-02-17)
### Feature
* Refactor icat generator to use python-icat ([`ae6ae0b`](https://github.com/ral-facilities/datagateway-api/commit/ae6ae0b2a2ce375fb0d47851b3091c952735f5c6))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "datagateway-api"
version = "6.3.0"
version = "6.3.2"
description = "ICAT API to interface with the DataGateway"
license = "Apache-2.0"
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def test_invalid_get_field(self, flask_test_app_db):
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
"fileCount": 30,
"fileSize": 3118779841,
},
id="not equal (ne)",
),
Expand Down Expand Up @@ -213,8 +213,8 @@ def test_invalid_get_field(self, flask_test_app_db):
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
"fileSize": 3118779841,
"fileCount": 30,
},
id="not like",
),
Expand All @@ -236,8 +236,8 @@ def test_invalid_get_field(self, flask_test_app_db):
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
"fileSize": 3118779841,
"fileCount": 30,
},
id="less than",
),
Expand All @@ -259,8 +259,8 @@ def test_invalid_get_field(self, flask_test_app_db):
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
"fileSize": 3118779841,
"fileCount": 30,
},
id="less than or equal",
),
Expand All @@ -280,8 +280,8 @@ def test_invalid_get_field(self, flask_test_app_db):
"political. Meeting those voice hand.",
"facilityID": 1,
"typeID": 1,
"fileSize": 0,
"fileCount": 0,
"fileSize": 3700075351,
"fileCount": 30,
},
id="greater than",
),
Expand All @@ -302,8 +302,8 @@ def test_invalid_get_field(self, flask_test_app_db):
"political. Meeting those voice hand.",
"facilityID": 1,
"typeID": 1,
"fileSize": 0,
"fileCount": 0,
"fileSize": 3700075351,
"fileCount": 30,
},
id="greater than or equal",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ class TestSearchAPICountDatasetFilesEndpoint:
marks=pytest.mark.skip,
),
pytest.param(
"1-4978-6907-2",
'{"name": "Datafile 1547"}',
"0-449-78690-0",
'{"name": "Datafile 1071"}',
{"count": 1},
id="Count dataset files with name condition",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"name": {"nlike": "Datafile 9"}}',
{"count": 14},
id="Count dataset files with name condition (operator specified)",
),
pytest.param(
"1-4978-6907-2",
'{"size": {"gt": 500}}',
{"count": 15},
"0-449-78690-0",
'{"size": {"gt": 155061161}}',
{"count": 3},
id="Count dataset files with size condition",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"name": "Unknown Datafile"}',
{"count": 0},
id="Count dataset files with filter to return zero count",
Expand Down
26 changes: 13 additions & 13 deletions test/integration/search_api/endpoints/test_get_dataset_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
"pid, request_filter, expected_json",
[
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 2}',
[
{
Expand All @@ -58,7 +58,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
id="Basic /Datasets/{pid}/files request",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 1, "skip": 5}',
[
{
Expand All @@ -72,7 +72,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
id="Get dataset files with skip",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 1, "where": {"name": "Datafile 1547"}}',
[
{
Expand All @@ -86,7 +86,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
id="Get dataset files with name condition",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 1, "where": {"name": {"nilike": "Datafile 10060"}}}',
[
{
Expand All @@ -100,27 +100,27 @@ class TestSearchAPIGetDatasetFilesEndpoint:
id="Get dataset files with name condition (operator specified)",
),
pytest.param(
"1-4978-6907-2",
'{"limit": 1, "where": {"size": {"gt": 5000000}}}',
"0-449-78690-0",
'{"limit": 1, "where": {"size": {"gt": 155061161}}}',
[
{
"id": "1071",
"name": "Datafile 1071",
"path": "/sense/through/candidate.jpeg",
"size": 9390543,
"id": "1309",
"name": "Datafile 1309",
"path": "/writer/family/pull.bmp",
"size": 171717920,
"dataset": None,
},
],
id="Get dataset files with size condition",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 1, "where": {"size": {"gt": 50000000000}}}',
[],
id="Get dataset files with condition to return empty list",
),
pytest.param(
"1-4978-6907-2",
"0-449-78690-0",
'{"limit": 1, "include": [{"relation": "dataset"}]}',
[
{
Expand All @@ -129,7 +129,7 @@ class TestSearchAPIGetDatasetFilesEndpoint:
"path": "/sense/through/candidate.jpeg",
"size": 9390543,
"dataset": {
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand Down
20 changes: 10 additions & 10 deletions test/integration/search_api/endpoints/test_get_entity_by_pid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class TestSearchAPIGetByPIDEndpoint:
[
pytest.param(
"Datasets",
"1-4978-6907-2",
"0-449-78690-0",
"{}",
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -77,10 +77,10 @@ class TestSearchAPIGetByPIDEndpoint:
),
pytest.param(
"Datasets",
"1-4978-6907-2",
"0-449-78690-0",
'{"include": [{"relation": "documents"}]}',
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -155,7 +155,7 @@ class TestSearchAPIGetByPIDEndpoint:
],
"datasets": [
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand All @@ -167,7 +167,7 @@ class TestSearchAPIGetByPIDEndpoint:
"samples": [],
},
{
"pid": "0-557-36716-6",
"pid": "1-182-78162-4",
"title": "DATASET 61",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -211,12 +211,12 @@ class TestSearchAPIGetByPIDEndpoint:
),
pytest.param(
"Datasets",
"1-4978-6907-2",
"0-449-78690-0",
'{"include": [{"relation": "documents"},'
' {"relation": "files"}, {"relation": "parameters"},'
' {"relation": "samples"}]}',
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand Down Expand Up @@ -430,7 +430,7 @@ class TestSearchAPIGetByPIDEndpoint:
],
"datasets": [
{
"pid": "1-4978-6907-2",
"pid": "0-449-78690-0",
"title": "DATASET 1",
"isPublic": True,
"size": None,
Expand All @@ -442,7 +442,7 @@ class TestSearchAPIGetByPIDEndpoint:
"samples": [],
},
{
"pid": "0-557-36716-6",
"pid": "1-182-78162-4",
"title": "DATASET 61",
"isPublic": True,
"size": None,
Expand Down
Loading

0 comments on commit d47a45d

Please sign in to comment.