Skip to content

Commit fa4c348

Browse files
committed
getting size of workspace
1 parent 4592ff7 commit fa4c348

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

services/storage/tests/unit/test_handlers_paths.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,51 @@ async def test_path_compute_size(
573573

574574
# get size of one of the nodes
575575
selected_node_id = NodeID(random.choice(list(project["workbench"]))) # noqa: S311
576+
path = Path(project["uuid"]) / f"{selected_node_id}"
576577
selected_node_s3_keys = [
577578
Path(s3_object_id) for s3_object_id in list_of_files[selected_node_id]
578579
]
579580
expected_total_size = project_params.allowed_file_sizes[0] * len(
580581
selected_node_s3_keys
581582
)
582-
path = Path(project["uuid"]) / f"{selected_node_id}"
583+
await _assert_compute_path_total_size(
584+
initialized_app,
585+
client,
586+
location_id,
587+
user_id,
588+
path=path,
589+
expected_total_size=expected_total_size,
590+
)
591+
592+
# get size of the outputs of one of the nodes
593+
path = Path(project["uuid"]) / f"{selected_node_id}" / "outputs"
594+
selected_node_s3_keys = [
595+
Path(s3_object_id)
596+
for s3_object_id in list_of_files[selected_node_id]
597+
if s3_object_id.startswith(f"{path}")
598+
]
599+
expected_total_size = project_params.allowed_file_sizes[0] * len(
600+
selected_node_s3_keys
601+
)
602+
await _assert_compute_path_total_size(
603+
initialized_app,
604+
client,
605+
location_id,
606+
user_id,
607+
path=path,
608+
expected_total_size=expected_total_size,
609+
)
610+
611+
# get size of workspace in one of the nodes (this is semi-cached in the DB)
612+
path = Path(project["uuid"]) / f"{selected_node_id}" / "workspace"
613+
selected_node_s3_keys = [
614+
Path(s3_object_id)
615+
for s3_object_id in list_of_files[selected_node_id]
616+
if s3_object_id.startswith(f"{path}")
617+
]
618+
expected_total_size = project_params.allowed_file_sizes[0] * len(
619+
selected_node_s3_keys
620+
)
583621
await _assert_compute_path_total_size(
584622
initialized_app,
585623
client,

0 commit comments

Comments
 (0)