|
58 | 58 | from simcore_service_storage.modules.long_running_tasks import ( |
59 | 59 | get_completed_upload_tasks, |
60 | 60 | ) |
| 61 | +from simcore_service_storage.simcore_s3_dsm import SimcoreS3DataManager |
61 | 62 | from sqlalchemy.ext.asyncio import AsyncEngine |
62 | 63 | from tenacity.asyncio import AsyncRetrying |
63 | 64 | from tenacity.retry import retry_if_exception_type |
@@ -87,9 +88,9 @@ async def assert_multipart_uploads_in_progress( |
87 | 88 | expected_upload_ids: list[str] | None, |
88 | 89 | ): |
89 | 90 | """if None is passed, then it checks that no uploads are in progress""" |
90 | | - list_uploads: list[ |
91 | | - tuple[UploadID, S3ObjectKey] |
92 | | - ] = await storage_s3_client.list_ongoing_multipart_uploads(bucket=storage_s3_bucket) |
| 91 | + list_uploads: list[tuple[UploadID, S3ObjectKey]] = ( |
| 92 | + await storage_s3_client.list_ongoing_multipart_uploads(bucket=storage_s3_bucket) |
| 93 | + ) |
93 | 94 | if expected_upload_ids is None: |
94 | 95 | assert ( |
95 | 96 | not list_uploads |
@@ -586,6 +587,12 @@ async def test_upload_real_file( |
586 | 587 | await upload_file(file_size, complex_file_name) |
587 | 588 |
|
588 | 589 |
|
| 590 | +@pytest.mark.parametrize( |
| 591 | + "location_id", |
| 592 | + [SimcoreS3DataManager.get_location_id()], |
| 593 | + ids=[SimcoreS3DataManager.get_location_name()], |
| 594 | + indirect=True, |
| 595 | +) |
589 | 596 | @pytest.mark.parametrize( |
590 | 597 | "file_size", |
591 | 598 | [ |
@@ -830,6 +837,12 @@ async def test_upload_real_file_with_s3_client( |
830 | 837 | assert s3_metadata.e_tag == completion_etag |
831 | 838 |
|
832 | 839 |
|
| 840 | +@pytest.mark.parametrize( |
| 841 | + "location_id", |
| 842 | + [SimcoreS3DataManager.get_location_id()], |
| 843 | + ids=[SimcoreS3DataManager.get_location_name()], |
| 844 | + indirect=True, |
| 845 | +) |
833 | 846 | @pytest.mark.parametrize( |
834 | 847 | "file_size", |
835 | 848 | [ |
@@ -930,7 +943,7 @@ async def _assert_file_downloaded( |
930 | 943 | async def test_download_file_no_file_was_uploaded( |
931 | 944 | initialized_app: FastAPI, |
932 | 945 | client: httpx.AsyncClient, |
933 | | - location_id: int, |
| 946 | + location_id: LocationID, |
934 | 947 | project_id: ProjectID, |
935 | 948 | node_id: NodeID, |
936 | 949 | user_id: UserID, |
@@ -966,7 +979,7 @@ async def test_download_file_1_to_1_with_file_meta_data( |
966 | 979 | client: httpx.AsyncClient, |
967 | 980 | file_size: ByteSize, |
968 | 981 | upload_file: Callable[[ByteSize, str], Awaitable[tuple[Path, SimcoreS3FileID]]], |
969 | | - location_id: int, |
| 982 | + location_id: LocationID, |
970 | 983 | user_id: UserID, |
971 | 984 | storage_s3_client: SimcoreS3API, |
972 | 985 | storage_s3_bucket: S3BucketName, |
@@ -1005,7 +1018,7 @@ async def test_download_file_from_inside_a_directory( |
1005 | 1018 | initialized_app: FastAPI, |
1006 | 1019 | client: httpx.AsyncClient, |
1007 | 1020 | file_size: ByteSize, |
1008 | | - location_id: int, |
| 1021 | + location_id: LocationID, |
1009 | 1022 | user_id: UserID, |
1010 | 1023 | project_id: ProjectID, |
1011 | 1024 | node_id: NodeID, |
@@ -1066,7 +1079,7 @@ async def test_download_file_from_inside_a_directory( |
1066 | 1079 | async def test_download_file_the_file_is_missing_from_the_directory( |
1067 | 1080 | initialized_app: FastAPI, |
1068 | 1081 | client: httpx.AsyncClient, |
1069 | | - location_id: int, |
| 1082 | + location_id: LocationID, |
1070 | 1083 | user_id: UserID, |
1071 | 1084 | project_id: ProjectID, |
1072 | 1085 | node_id: NodeID, |
@@ -1099,7 +1112,7 @@ async def test_download_file_the_file_is_missing_from_the_directory( |
1099 | 1112 | async def test_download_file_access_rights( |
1100 | 1113 | initialized_app: FastAPI, |
1101 | 1114 | client: httpx.AsyncClient, |
1102 | | - location_id: int, |
| 1115 | + location_id: LocationID, |
1103 | 1116 | user_id: UserID, |
1104 | 1117 | storage_s3_client: SimcoreS3API, |
1105 | 1118 | storage_s3_bucket: S3BucketName, |
@@ -1144,7 +1157,7 @@ async def test_delete_file( |
1144 | 1157 | client: httpx.AsyncClient, |
1145 | 1158 | file_size: ByteSize, |
1146 | 1159 | upload_file: Callable[[ByteSize, str], Awaitable[tuple[Path, SimcoreS3FileID]]], |
1147 | | - location_id: int, |
| 1160 | + location_id: LocationID, |
1148 | 1161 | user_id: UserID, |
1149 | 1162 | faker: Faker, |
1150 | 1163 | ): |
@@ -1321,7 +1334,7 @@ async def test_ensure_expand_dirs_defaults_true( |
1321 | 1334 | mocker: MockerFixture, |
1322 | 1335 | client: httpx.AsyncClient, |
1323 | 1336 | user_id: UserID, |
1324 | | - location_id: int, |
| 1337 | + location_id: LocationID, |
1325 | 1338 | ): |
1326 | 1339 | mocked_object = mocker.patch( |
1327 | 1340 | "simcore_service_storage.simcore_s3_dsm.SimcoreS3DataManager.list_files", |
|
0 commit comments