Skip to content

Commit 1412a03

Browse files
committed
removed unnecessary test
1 parent 9ca88ca commit 1412a03

File tree

2 files changed

+40
-93
lines changed

2 files changed

+40
-93
lines changed

services/web/server/tests/integration/01/notifications/test_rabbitmq_consumers.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import socketio
1313
import sqlalchemy as sa
1414
from aiohttp.test_utils import TestClient
15-
from aioresponses import aioresponses as AioResponsesMock
1615
from faker import Faker
1716
from models_library.api_schemas_webserver.socketio import SocketIORoomStr
1817
from models_library.progress_bar import ProgressReport
@@ -39,7 +38,6 @@
3938
)
4039
from servicelib.rabbitmq import RabbitMQClient
4140
from settings_library.rabbit import RabbitSettings
42-
from simcore_postgres_database.models.projects import projects
4341
from simcore_postgres_database.models.users import UserRole
4442
from simcore_service_webserver.application_settings import setup_settings
4543
from simcore_service_webserver.db.plugin import setup_db
@@ -58,11 +56,9 @@
5856
from simcore_service_webserver.socketio.messages import (
5957
SOCKET_IO_EVENT,
6058
SOCKET_IO_LOG_EVENT,
61-
SOCKET_IO_NODE_UPDATED_EVENT,
6259
)
6360
from simcore_service_webserver.socketio.models import WebSocketNodeProgress
6461
from simcore_service_webserver.socketio.plugin import setup_socketio
65-
from sqlalchemy.ext.asyncio import AsyncEngine
6662
from tenacity import RetryError
6763
from tenacity.asyncio import AsyncRetrying
6864
from tenacity.retry import retry_always, retry_if_exception_type
@@ -402,90 +398,6 @@ async def mocked_dynamic_services_interface(
402398
return mock
403399

404400

405-
@pytest.mark.parametrize("user_role", [UserRole.GUEST], ids=str)
406-
@pytest.mark.parametrize(
407-
"sender_same_user_id", [True, False], ids=lambda id_: f"same_sender_id={id_}"
408-
)
409-
@pytest.mark.parametrize(
410-
"subscribe_to_logs", [True, False], ids=lambda id_: f"subscribed={id_}"
411-
)
412-
async def test_progress_computational_workflow(
413-
mocked_dynamic_services_interface,
414-
director_v2_service_mock: AioResponsesMock,
415-
client: TestClient,
416-
rabbitmq_publisher: RabbitMQClient,
417-
user_project: ProjectDict,
418-
create_socketio_connection: Callable[
419-
[str | None, TestClient | None], Awaitable[tuple[socketio.AsyncClient, str]]
420-
],
421-
mocker: MockerFixture,
422-
sqlalchemy_async_engine: AsyncEngine,
423-
subscribe_to_logs: bool,
424-
# user
425-
sender_same_user_id: bool,
426-
sender_user_id: UserID,
427-
# project
428-
random_node_id_in_user_project: NodeID,
429-
user_project_id: ProjectID,
430-
):
431-
"""
432-
RabbitMQ (TOPIC) --> Webserver --> DB (get project)
433-
Redis --> webclient (socketio)
434-
435-
"""
436-
socket_io_conn, *_ = await create_socketio_connection(None, client)
437-
438-
mock_progress_handler = mocker.MagicMock()
439-
socket_io_conn.on(SOCKET_IO_NODE_UPDATED_EVENT, handler=mock_progress_handler)
440-
441-
if subscribe_to_logs:
442-
assert client.app
443-
await project_logs.subscribe(client.app, user_project_id)
444-
# this simulates the user openning the project
445-
await get_socket_server(client.app).enter_room(
446-
socket_io_conn.get_sid(), SocketIORoomStr.from_project_id(user_project_id)
447-
)
448-
progress_message = ProgressRabbitMessageNode(
449-
user_id=sender_user_id,
450-
project_id=user_project_id,
451-
node_id=random_node_id_in_user_project,
452-
progress_type=ProgressType.COMPUTATION_RUNNING,
453-
report=ProgressReport(actual_value=0.3, total=1),
454-
)
455-
await rabbitmq_publisher.publish(progress_message.channel_name, progress_message)
456-
457-
call_expected = sender_same_user_id and subscribe_to_logs
458-
if call_expected:
459-
expected_call = jsonable_encoder(
460-
progress_message, include={"node_id", "project_id"}
461-
)
462-
expected_call |= {
463-
"data": user_project["workbench"][f"{random_node_id_in_user_project}"]
464-
}
465-
expected_call["data"]["progress"] = int(
466-
progress_message.report.percent_value * 100
467-
)
468-
await _assert_handler_called_with_json(mock_progress_handler, expected_call)
469-
else:
470-
await _assert_handler_not_called(mock_progress_handler)
471-
472-
# check the database. doing it after the waiting calls above is safe
473-
async with sqlalchemy_async_engine.connect() as conn:
474-
assert projects is not None
475-
result = await conn.execute(
476-
sa.select(projects.c.workbench).where(
477-
projects.c.uuid == str(user_project_id)
478-
)
479-
)
480-
row = result.one()
481-
project_workbench = dict(row[projects.c.workbench])
482-
# NOTE: the progress might still be present but is not used anymore
483-
assert (
484-
project_workbench[f"{random_node_id_in_user_project}"].get("progress", 0)
485-
== 0
486-
)
487-
488-
489401
@pytest.mark.parametrize("user_role", [UserRole.GUEST], ids=str)
490402
@pytest.mark.parametrize("metrics_name", ["service_started", "service_stopped"])
491403
async def test_instrumentation_workflow(

services/web/server/tests/integration/01/test_computation.py

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,44 @@ async def test_running_computation_sends_progress_updates_via_socketio(
647647
"expected progress updates to be sent via socketio, "
648648
f"but got {mock_progress_handler.call_count} calls"
649649
)
650-
# check that the last progress update was for the SUCCESS state
651-
last_call_args = mock_progress_handler.call_args_list[-1][0]
652-
assert len(last_call_args) == 1, (
653-
"expected the progress handler to be called with a single argument, "
654-
f"but got {len(last_call_args)} arguments"
650+
651+
# Get all computational nodes from the workbench (exclude file-picker nodes)
652+
computational_node_ids = {
653+
node_id
654+
for node_id, node_data in user_project["workbench"].items()
655+
if node_data.get("key", "").startswith("simcore/services/comp/")
656+
}
657+
658+
# Collect all node IDs that received progress updates
659+
received_progress_node_ids = set()
660+
for call_args in mock_progress_handler.call_args_list:
661+
assert len(call_args[0]) == 1, (
662+
"expected the progress handler to be called with a single argument, "
663+
f"but got {len(call_args[0])} arguments"
664+
)
665+
message = call_args[0][0]
666+
assert isinstance(
667+
message, dict
668+
), f"expected message to be dict, got {type(message)}"
669+
assert (
670+
"node_id" in message
671+
), f"expected 'node_id' in message, got {message.keys()}"
672+
assert (
673+
"project_id" in message
674+
), f"expected 'project_id' in message, got {message.keys()}"
675+
assert (
676+
message["project_id"] == project_id
677+
), f"expected project_id to match {project_id}, got {message['project_id']}"
678+
received_progress_node_ids.add(message["node_id"])
679+
680+
# Verify that progress updates were sent for ALL computational nodes
681+
missing_nodes = computational_node_ids - received_progress_node_ids
682+
assert not missing_nodes, (
683+
f"expected progress updates for all computational nodes {computational_node_ids}, "
684+
f"but missing updates for {missing_nodes}. "
685+
f"Received updates for: {received_progress_node_ids}"
686+
)
687+
688+
print(
689+
f"✓ Successfully received progress updates for all {len(computational_node_ids)} computational nodes: {computational_node_ids}"
655690
)

0 commit comments

Comments
 (0)