From 6da5581c4a2fc2ea6a3863e63aacf327c11c5ab8 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Fri, 9 Aug 2024 10:55:55 +0545 Subject: [PATCH 1/4] perf(test-cases): don't run if task is failed --- .github/workflows/Unit-Test.yml | 1 + API/tasks.py | 4 ++-- tests/test_API.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Unit-Test.yml b/.github/workflows/Unit-Test.yml index 51ed16d7..f27ad4d6 100644 --- a/.github/workflows/Unit-Test.yml +++ b/.github/workflows/Unit-Test.yml @@ -6,6 +6,7 @@ on: branches: - master - develop + - fix/tests pull_request: branches: - master diff --git a/API/tasks.py b/API/tasks.py index 9d5295ee..9652992c 100644 --- a/API/tasks.py +++ b/API/tasks.py @@ -71,8 +71,8 @@ def get_task_status( if task_result.status == "SUCCESS": task_response_result = task_result.result if task_result.state != "SUCCESS": - task_response_result = "N/A" # TODO : Make sure no imp information is popping out outside of the API - # task_response_result = str(task_result.info) + # task_response_result = "N/A" # TODO : Make sure no imp information is popping out outside of the API + task_response_result = str(task_result.info) result = { "id": task_id, diff --git a/tests/test_API.py b/tests/test_API.py index 2475bca2..1f0649c0 100644 --- a/tests/test_API.py +++ b/tests/test_API.py @@ -34,6 +34,8 @@ def wait_for_task_completion(track_link, max_attempts=12, interval_seconds=5): if check_status == "SUCCESS": return res # Task completed successfully + if check_status == "FAILURE": + raise AssertionError("Task failed") if attempt == max_attempts: raise AssertionError( From 816814927353065064ae2bb5d523ce7dbe3044d3 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Fri, 9 Aug 2024 11:02:15 +0545 Subject: [PATCH 2/4] add error result --- tests/test_API.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_API.py b/tests/test_API.py index 1f0649c0..8b28052f 100644 --- a/tests/test_API.py +++ b/tests/test_API.py @@ -35,7 +35,7 @@ def wait_for_task_completion(track_link, max_attempts=12, interval_seconds=5): if check_status == "SUCCESS": return res # Task completed successfully if check_status == "FAILURE": - raise AssertionError("Task failed") + raise AssertionError(f"Task failed {res}") if attempt == max_attempts: raise AssertionError( From 5dba5ea84a836eaf84b8d3dbcacbf1a84ef55bbd Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Fri, 9 Aug 2024 11:10:37 +0545 Subject: [PATCH 3/4] fix(unit-test-failing): only add file format if tiles are enabled --- src/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app.py b/src/app.py index 65263c28..97b633ec 100644 --- a/src/app.py +++ b/src/app.py @@ -738,7 +738,7 @@ def extract_current_data(self, exportname): dump_temp_file_path = os.path.join( working_dir, - f"{self.params.file_name if self.params.file_name else 'Export'}{'' if output_type == RawDataOutputType.MVT.value else f'.{output_type.lower()}'}", + f"{self.params.file_name if self.params.file_name else 'Export'}{f'.{output_type.lower()}'}", ) try: @@ -749,6 +749,10 @@ def extract_current_data(self, exportname): RawDataOutputType.MBTILES.value, RawDataOutputType.MVT.value, ]: + dump_temp_file_path = os.path.join( + working_dir, + f"{self.params.file_name if self.params.file_name else 'Export'}{'' if output_type == RawDataOutputType.MVT.value else f'.{output_type.lower()}'}", + ) RawData.ogr_export( query=raw_currentdata_extraction_query( self.params, From 8fa273ab5f85532cf9d2c55a6505a65d0005ab82 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Fri, 9 Aug 2024 11:11:17 +0545 Subject: [PATCH 4/4] Fix up actions --- .github/workflows/Unit-Test.yml | 1 - API/tasks.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Unit-Test.yml b/.github/workflows/Unit-Test.yml index f27ad4d6..51ed16d7 100644 --- a/.github/workflows/Unit-Test.yml +++ b/.github/workflows/Unit-Test.yml @@ -6,7 +6,6 @@ on: branches: - master - develop - - fix/tests pull_request: branches: - master diff --git a/API/tasks.py b/API/tasks.py index 9652992c..9d5295ee 100644 --- a/API/tasks.py +++ b/API/tasks.py @@ -71,8 +71,8 @@ def get_task_status( if task_result.status == "SUCCESS": task_response_result = task_result.result if task_result.state != "SUCCESS": - # task_response_result = "N/A" # TODO : Make sure no imp information is popping out outside of the API - task_response_result = str(task_result.info) + task_response_result = "N/A" # TODO : Make sure no imp information is popping out outside of the API + # task_response_result = str(task_result.info) result = { "id": task_id,