Merge pull request #21 from Aignosi/SIENTIAPDE-1182-ajustar-laborious-para-pegar-timestamp-da-resposta-do-mlflow
Fix: Handle empty receiver groups in Alerts workflow and add corresponding test
This commit is contained in:
@@ -70,6 +70,9 @@ class Alerts:
|
|||||||
retry_policy=retry_policy
|
retry_policy=retry_policy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not receiver_groups:
|
||||||
|
return
|
||||||
|
|
||||||
# Call subworkflow "process_notifications" passing the notification package
|
# Call subworkflow "process_notifications" passing the notification package
|
||||||
log_report = await workflow.execute_child_workflow(
|
log_report = await workflow.execute_child_workflow(
|
||||||
'process_notifications',
|
'process_notifications',
|
||||||
|
|||||||
@@ -117,6 +117,22 @@ async def test_run_no_data(workflow_mock, alerts):
|
|||||||
workflow_mock.execute_local_activity_method.assert_not_called()
|
workflow_mock.execute_local_activity_method.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@mark.asyncio
|
||||||
|
@patch("orchestrator.workflows.alerts.workflow", new_callable=AsyncMock)
|
||||||
|
async def test_run_no_receiver_groups(workflow_mock, alerts):
|
||||||
|
workflow_mock.execute_local_activity_method.return_value = {}
|
||||||
|
|
||||||
|
input_data = {
|
||||||
|
'schedule_name': 'test-schedule-name',
|
||||||
|
'notification_ttl': 300,
|
||||||
|
'sent_ttl': 600
|
||||||
|
}
|
||||||
|
|
||||||
|
await alerts.run(input_data)
|
||||||
|
|
||||||
|
assert workflow_mock.execute_child_workflow.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
@mark.asyncio
|
@mark.asyncio
|
||||||
@patch("orchestrator.workflows.alerts.workflow", new_callable=AsyncMock)
|
@patch("orchestrator.workflows.alerts.workflow", new_callable=AsyncMock)
|
||||||
async def test_run_no_log_report(workflow_mock, alerts):
|
async def test_run_no_log_report(workflow_mock, alerts):
|
||||||
|
|||||||
Reference in New Issue
Block a user