diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 5b503fb8..8613acc3 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -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 @@ -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 @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c0750f..31453b18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ +## 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)) diff --git a/pyproject.toml b/pyproject.toml index fc4e838f..5ee6e580 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/test/integration/datagateway_api/db/test_database_filter_utilities.py b/test/integration/datagateway_api/db/test_database_filter_utilities.py index a571b7c1..d0ce50a2 100644 --- a/test/integration/datagateway_api/db/test_database_filter_utilities.py +++ b/test/integration/datagateway_api/db/test_database_filter_utilities.py @@ -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)", ), @@ -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", ), @@ -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", ), @@ -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", ), @@ -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", ), @@ -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", ), diff --git a/test/integration/search_api/endpoints/test_count_dataset_files.py b/test/integration/search_api/endpoints/test_count_dataset_files.py index 77afa970..24b6a996 100644 --- a/test/integration/search_api/endpoints/test_count_dataset_files.py +++ b/test/integration/search_api/endpoints/test_count_dataset_files.py @@ -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", diff --git a/test/integration/search_api/endpoints/test_get_dataset_files.py b/test/integration/search_api/endpoints/test_get_dataset_files.py index 00790db9..952d6008 100644 --- a/test/integration/search_api/endpoints/test_get_dataset_files.py +++ b/test/integration/search_api/endpoints/test_get_dataset_files.py @@ -37,7 +37,7 @@ class TestSearchAPIGetDatasetFilesEndpoint: "pid, request_filter, expected_json", [ pytest.param( - "1-4978-6907-2", + "0-449-78690-0", '{"limit": 2}', [ { @@ -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}', [ { @@ -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"}}', [ { @@ -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"}}}', [ { @@ -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"}]}', [ { @@ -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, diff --git a/test/integration/search_api/endpoints/test_get_entity_by_pid.py b/test/integration/search_api/endpoints/test_get_entity_by_pid.py index 44a5310f..e0eee5b1 100644 --- a/test/integration/search_api/endpoints/test_get_entity_by_pid.py +++ b/test/integration/search_api/endpoints/test_get_entity_by_pid.py @@ -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, @@ -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, @@ -155,7 +155,7 @@ class TestSearchAPIGetByPIDEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -167,7 +167,7 @@ class TestSearchAPIGetByPIDEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, @@ -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, @@ -430,7 +430,7 @@ class TestSearchAPIGetByPIDEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -442,7 +442,7 @@ class TestSearchAPIGetByPIDEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, diff --git a/test/integration/search_api/endpoints/test_search_endpoint.py b/test/integration/search_api/endpoints/test_search_endpoint.py index 93dd3ed9..127823eb 100644 --- a/test/integration/search_api/endpoints/test_search_endpoint.py +++ b/test/integration/search_api/endpoints/test_search_endpoint.py @@ -15,7 +15,7 @@ class TestSearchAPISearchEndpoint: '{"limit": 2}', [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -27,7 +27,7 @@ class TestSearchAPISearchEndpoint: "samples": [], }, { - "pid": "1-01-107043-X", + "pid": "1-07-598386-X", "title": "DATASET 2", "isPublic": True, "size": None, @@ -101,7 +101,7 @@ class TestSearchAPISearchEndpoint: '{"limit": 1, "skip": 5}', [ { - "pid": "1-77218-518-3", + "pid": "0-614-81100-7", "title": "DATASET 6", "isPublic": True, "size": None, @@ -134,7 +134,7 @@ class TestSearchAPISearchEndpoint: ' "2007-06-30T08:30:58.000Z"}}}', [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -190,7 +190,7 @@ class TestSearchAPISearchEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -202,7 +202,7 @@ class TestSearchAPISearchEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, @@ -266,7 +266,7 @@ class TestSearchAPISearchEndpoint: '{"where":{"isPublic": {"eq": "True"}}, "limit": 1}', [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -303,7 +303,7 @@ class TestSearchAPISearchEndpoint: '{"unit": "unit 1"}]}}}]}', [ { - "pid": "1-85271-859-5", + "pid": "0-490-31235-7", "title": "DATASET 33", "isPublic": True, "size": None, @@ -350,7 +350,7 @@ class TestSearchAPISearchEndpoint: ' "unit 39"}]}}}]}', [ { - "pid": "1-71395-013-8", + "pid": "1-351-03363-8", "title": "DATASET 71", "isPublic": True, "size": None, @@ -389,7 +389,7 @@ class TestSearchAPISearchEndpoint: '"name": "PARAMETERTYPE 39"}, {"value": 44}]}]}}}]}', [ { - "pid": "1-71395-013-8", + "pid": "1-351-03363-8", "title": "DATASET 71", "isPublic": True, "size": None, @@ -427,7 +427,7 @@ class TestSearchAPISearchEndpoint: ' "Datafile 25"}}}], "limit": 1}', [ { - "pid": "1-85150-280-7", + "pid": "0-87851-502-X", "title": "DATASET 13", "isPublic": True, "size": None, @@ -690,7 +690,7 @@ class TestSearchAPISearchEndpoint: ], "datasets": [ { - "pid": "1-4978-6907-2", + "pid": "0-449-78690-0", "title": "DATASET 1", "isPublic": True, "size": None, @@ -711,7 +711,7 @@ class TestSearchAPISearchEndpoint: "samples": [], }, { - "pid": "0-557-36716-6", + "pid": "1-182-78162-4", "title": "DATASET 61", "isPublic": True, "size": None, diff --git a/util/icat_db_generator.py b/util/icat_db_generator.py index e8716434..0f0542ff 100644 --- a/util/icat_db_generator.py +++ b/util/icat_db_generator.py @@ -600,7 +600,6 @@ def generate_dataset(self, i): dataset.name = f"{tablename} {i}" dataset.description = faker.text() dataset.fileCount = 15 - dataset.fileSize = faker.random_int(123, 213123121) dataset.doi = faker.isbn10(separator="-") dataset.startDate = get_start_date(i) dataset.endDate = get_end_date(i)