From 50d0c7a666f3ea8ab6c656f096c6c6b76db963ef Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 6 Aug 2024 16:57:27 +0200 Subject: [PATCH 1/2] Don't set size to 0 on dataset purge --- lib/galaxy/model/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 84a28aaa396a..582da171d315 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -4211,8 +4211,6 @@ def full_delete(self): # TODO: purge metadata files self.deleted = True self.purged = True - self.file_size = 0 - self.total_size = 0 def get_access_roles(self, security_agent): roles = [] From 847ac059d56ebbbd0cd2c65c739bcd676583adff Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 6 Aug 2024 17:33:02 +0200 Subject: [PATCH 2/2] Test that we don't reset the file size --- lib/galaxy_test/api/test_datasets.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/galaxy_test/api/test_datasets.py b/lib/galaxy_test/api/test_datasets.py index 9705d2d2b577..dd9084c8c4f4 100644 --- a/lib/galaxy_test/api/test_datasets.py +++ b/lib/galaxy_test/api/test_datasets.py @@ -658,6 +658,19 @@ def _run_cancel_job(self, history_id: str, use_query_params: bool = False): deleted_job_details = self.dataset_populator.get_job_details(job_id).json() assert deleted_job_details["state"] in ("deleting", "deleted"), deleted_job_details + def test_purge_does_not_reset_file_size(self): + with self.dataset_populator.test_history() as history_id: + dataset = self.dataset_populator.new_dataset(history_id=history_id, content="ABC", wait=True) + assert dataset["file_size"] + self.dataset_populator.delete_dataset( + history_id=history_id, content_id=dataset["id"], purge=True, wait_for_purge=True + ) + purged_dataset = self.dataset_populator.get_history_dataset_details( + history_id=history_id, content_id=dataset["id"] + ) + assert purged_dataset["purged"] + assert dataset["file_size"] == purged_dataset["file_size"] + def test_delete_batch(self): num_datasets = 4 dataset_map: Dict[int, str] = {}