# HG changeset patch # User Alain Mazy # Date 1702546869 -3600 # Node ID f4f0e2d24a51be45777c16a0058b07bb02817c99 # Parent 6753d96dd71f826d5495de910ca4e4058773208c more pg-transactions tests diff -r 6753d96dd71f -r f4f0e2d24a51 NewTests/Concurrency/test_concurrency.py --- a/NewTests/Concurrency/test_concurrency.py Tue Dec 12 15:31:45 2023 +0100 +++ b/NewTests/Concurrency/test_concurrency.py Thu Dec 14 10:41:09 2023 +0100 @@ -150,7 +150,7 @@ workers_count=workers_count) elapsed = time.time() - start_time - print(f"test_concurrent_uploads_same_study with {workers_count} workers and {repeat_count}x repeat: {elapsed:.3f} s") + print(f"TIMING test_concurrent_uploads_same_study with {workers_count} workers and {repeat_count}x repeat: {elapsed:.3f} s") self.assertTrue(self.o.is_alive()) @@ -177,9 +177,9 @@ self.assertEqual(0, stats.get("CountSeries")) self.assertEqual(0, stats.get("CountInstances")) self.assertEqual(0, int(stats.get("TotalDiskSize"))) + # time.sleep(10000) self.assertTrue(self.is_storage_empty(self._storage_name)) - def test_concurrent_anonymize_same_study(self): self.o.delete_all_content() self.clear_storage(storage_name=self._storage_name) @@ -199,7 +199,7 @@ workers_count=workers_count) elapsed = time.time() - start_time - print(f"test_concurrent_anonymize_same_study with {workers_count} workers and {repeat_count}x repeat: {elapsed:.3f} s") + print(f"TIMING test_concurrent_anonymize_same_study with {workers_count} workers and {repeat_count}x repeat: {elapsed:.3f} s") self.assertTrue(self.o.is_alive()) @@ -213,8 +213,13 @@ self.assertEqual(2 * (1 + workers_count * repeat_count), stats.get("CountSeries")) self.assertEqual(50 * (1 + workers_count * repeat_count), stats.get("CountInstances")) + start_time = time.time() + self.o.instances.delete(orthanc_ids=self.o.instances.get_all_ids()) + elapsed = time.time() - start_time + print(f"TIMING test_concurrent_anonymize_same_study deletion took: {elapsed:.3f} s") + self.assertEqual(0, len(self.o.studies.get_all_ids())) self.assertEqual(0, len(self.o.series.get_all_ids())) self.assertEqual(0, len(self.o.instances.get_all_ids())) @@ -244,7 +249,7 @@ workers_count=workers_count) elapsed = time.time() - start_time - print(f"test_upload_delete_same_study_from_multiple_threads with {workers_count} workers and {repeat_count}x repeat: {elapsed:.3f} s") + print(f"TIMING test_upload_delete_same_study_from_multiple_threads with {workers_count} workers and {repeat_count}x repeat: {elapsed:.3f} s") self.assertTrue(self.o.is_alive()) diff -r 6753d96dd71f -r f4f0e2d24a51 NewTests/helpers.py --- a/NewTests/helpers.py Tue Dec 12 15:31:45 2023 +0100 +++ b/NewTests/helpers.py Thu Dec 14 10:41:09 2023 +0100 @@ -137,7 +137,14 @@ @classmethod def clear_storage(cls, storage_name: str): storage_path = cls.get_storage_path(storage_name=storage_name) - shutil.rmtree(storage_path, ignore_errors=True) + + # clear the directory but keep it ! + for root, dirs, files in os.walk(storage_path): + for f in files: + os.unlink(os.path.join(root, f)) + for d in dirs: + shutil.rmtree(os.path.join(root, d)) + shutil.rmtree(storage_path, ignore_errors=True) @classmethod def is_storage_empty(cls, storage_name: str): diff -r 6753d96dd71f -r f4f0e2d24a51 NewTests/requirements.txt --- a/NewTests/requirements.txt Tue Dec 12 15:31:45 2023 +0100 +++ b/NewTests/requirements.txt Thu Dec 14 10:41:09 2023 +0100 @@ -1,3 +1,3 @@ -orthanc-api-client>=0.13.6 +orthanc-api-client>=0.14.4 orthanc-tools>=0.8.9 uvicorn \ No newline at end of file