Skip to content
Snippets Groups Projects
Commit 7dcfd211 authored by Janet Goldstein's avatar Janet Goldstein
Browse files

WS-651: workflow request ID should be in message subject

parent 66fb0a66
No related branches found
No related tags found
1 merge request!505WS-651: catches and saves RH CARTA event
Pipeline #2917 passed
......@@ -65,7 +65,7 @@ class TestCapabilityService:
"service": "capability",
"routing_key": "capability",
"carta_url": carta_url,
"subject": "Your CARTA Session is ready!",
"subject": {"workflow_request_id": wf_request_id},
"type": "carta-ready",
}
......@@ -75,7 +75,7 @@ class TestCapabilityService:
"workspaces.capability.services.capability_info.CapabilityInfo.lookup_execution_by_workflow_request_id",
return_value=mock_capability_execution,
):
mock_capability_service.on_carta_ready(wf_request_id, **fake_carta_ready_msg)
mock_capability_service.on_carta_ready(**fake_carta_ready_msg)
assert mock_capability_info.save_entity.call_count == save_entity_old_call_count + 1
(request_version,) = mock_capability_info.save_entity.call_args.args
......
......@@ -152,7 +152,7 @@ class CapabilityService(CapabilityServiceIF):
self.capability_info.save_entity(request)
@on_message(type="carta-ready")
def on_carta_ready(self, cp_request_id: int, **message: Dict[str, str]):
def on_carta_ready(self, **message: Dict[str, str]):
"""
Catch the RH-flavored event and save it to the capability request version metadata
......@@ -161,7 +161,9 @@ class CapabilityService(CapabilityServiceIF):
"""
logger.info(f"RECEIVED CARTA READY MESSAGE: {message}")
execution = self.capability_info.lookup_execution_by_workflow_request_id(cp_request_id)
wf_request_id = int(message["subject"]["workflow_request_id"])
execution = self.capability_info.lookup_execution_by_workflow_request_id(wf_request_id)
request_version = execution.version
request_version.workflow_metadata = {"carta_url": message["carta_url"]}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment