SIENTIAPDE-1172
Update values.yaml and tests to incorporate mail_type parameter for notification handling - Changed GITHUB_BRANCH in values.yaml to reflect the new alert pipeline. - Added 'mail_type' parameter to various test cases in SlotManager and notification workflows to enhance notification specificity and tracking. - Ensured consistency in test data structures across multiple test functions.
This commit is contained in:
@@ -217,7 +217,8 @@ async def test_get_last_data_timestamp_none(slot_manager):
|
||||
test_data = {
|
||||
**metadata,
|
||||
'workflow_name': 'test_pipeline',
|
||||
'schedule_name': 'test_schedule'
|
||||
'schedule_name': 'test_schedule',
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
slot_manager.get = MagicMock(return_value=None)
|
||||
@@ -233,7 +234,8 @@ async def test_get_last_data_timestamp_not_none(slot_manager):
|
||||
test_data = {
|
||||
**metadata,
|
||||
'workflow_name': 'test_pipeline',
|
||||
'schedule_name': 'test_schedule'
|
||||
'schedule_name': 'test_schedule',
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
slot_manager.get = MagicMock(return_value='2023-01-01 12:00:00')
|
||||
@@ -241,7 +243,7 @@ async def test_get_last_data_timestamp_not_none(slot_manager):
|
||||
result = await slot_manager.get_last_data_timestamp(test_data)
|
||||
|
||||
slot_manager.get.assert_called_once_with(
|
||||
'notification_last_timestamp'
|
||||
'notification_last_timestamp:test_mail_type'
|
||||
)
|
||||
|
||||
assert result == '2023-01-01 12:00:00'
|
||||
@@ -253,7 +255,8 @@ async def test_get_last_data_timestamp_error(slot_manager):
|
||||
test_data = {
|
||||
**metadata,
|
||||
'workflow_name': 'test_pipeline',
|
||||
'schedule_name': 'test_schedule'
|
||||
'schedule_name': 'test_schedule',
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
slot_manager.send_notification = MagicMock()
|
||||
@@ -286,7 +289,8 @@ async def test_put_last_data_timestamp_empty_dataframe(slot_manager):
|
||||
**metadata,
|
||||
'workflow_name': 'test_pipeline',
|
||||
'schedule_name': 'test_schedule',
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records')
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records'),
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
slot_manager.set = MagicMock()
|
||||
@@ -311,7 +315,8 @@ async def test_put_last_data_timestamp_not_empty_dataframe(slot_manager):
|
||||
**metadata,
|
||||
'workflow_name': 'test_pipeline',
|
||||
'schedule_name': 'test_schedule',
|
||||
'data': data.to_dict('records')
|
||||
'data': data.to_dict('records'),
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
slot_manager.set = MagicMock()
|
||||
@@ -321,7 +326,7 @@ async def test_put_last_data_timestamp_not_empty_dataframe(slot_manager):
|
||||
assert result == '2023-01-01 12:00:01'
|
||||
|
||||
slot_manager.set.assert_called_once_with(
|
||||
'notification_last_timestamp',
|
||||
'notification_last_timestamp:test_mail_type',
|
||||
'2023-01-01 12:00:01',
|
||||
ttl=18000
|
||||
)
|
||||
@@ -338,7 +343,8 @@ async def test_put_last_data_timestamp_error(slot_manager):
|
||||
'name': ['sensor1', 'sensor2'],
|
||||
'value': [25.5, 30.0],
|
||||
'timestamp': ['2023-01-01 12:00:00'] * 2
|
||||
}).to_dict('records')
|
||||
}).to_dict('records'),
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
slot_manager.send_notification = MagicMock()
|
||||
@@ -401,7 +407,8 @@ async def test_filter_notification_alerts(slot_manager):
|
||||
'contents': ['core_alerts']
|
||||
}
|
||||
],
|
||||
'notification_ttl': 300
|
||||
'notification_ttl': 300,
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
response = await slot_manager.filter_notification_alerts(input_data)
|
||||
|
||||
@@ -24,6 +24,7 @@ metadata = {
|
||||
async def test_run(workflow_mock, load_notification_package):
|
||||
input_data = {
|
||||
'metadata': metadata,
|
||||
'mail_type': 'test_mail_type',
|
||||
'base_data_filter': {
|
||||
'level': 'ERROR'
|
||||
}
|
||||
@@ -62,7 +63,10 @@ async def test_run(workflow_mock, load_notification_package):
|
||||
workflow_mock.start_local_activity_method.assert_has_calls([
|
||||
call(
|
||||
Activities.get_last_data_timestamp,
|
||||
input_data['metadata'],
|
||||
{
|
||||
**input_data['metadata'],
|
||||
'mail_type': 'test_mail_type'
|
||||
},
|
||||
start_to_close_timeout=ANY,
|
||||
retry_policy=ANY
|
||||
)
|
||||
@@ -110,7 +114,8 @@ async def test_run(workflow_mock, load_notification_package):
|
||||
{
|
||||
'id': '1',
|
||||
}
|
||||
]
|
||||
],
|
||||
'mail_type': 'test_mail_type'
|
||||
},
|
||||
start_to_close_timeout=ANY,
|
||||
retry_policy=ANY
|
||||
@@ -123,6 +128,7 @@ async def test_run(workflow_mock, load_notification_package):
|
||||
async def test_run_no_data(workflow_mock, load_notification_package):
|
||||
input_data = {
|
||||
'metadata': metadata,
|
||||
'mail_type': 'test_mail_type',
|
||||
'base_data_filter': {
|
||||
'level': 'ERROR'
|
||||
}
|
||||
@@ -152,7 +158,8 @@ async def test_run_no_data(workflow_mock, load_notification_package):
|
||||
'metadata': metadata,
|
||||
'base_data_filter': {
|
||||
'level': 'ERROR'
|
||||
}
|
||||
},
|
||||
'mail_type': 'test_mail_type'
|
||||
}
|
||||
|
||||
workflow_mock.start_local_activity_method.side_effect = [
|
||||
|
||||
@@ -132,7 +132,7 @@ env:
|
||||
- name: GITHUB_REPO_URL
|
||||
value: "git@github.com:Aignosi/sientia-dataops-orchestrator_temporal.git"
|
||||
- name: GITHUB_BRANCH
|
||||
value: "SIENTIAPDE-1171-criar-pipeline-de-retreino-laborious"
|
||||
value: "SIENTIAPDE-1172-criar-pipeline-de-alertas-orquestrador"
|
||||
- name: PYTHON_APP
|
||||
value: "orchestrator.worker.worker"
|
||||
|
||||
@@ -216,4 +216,4 @@ ssh:
|
||||
|
||||
# kubectl create secret generic smtp-credentials \
|
||||
# --namespace sientia \
|
||||
# --from-literal=app_password='sua-senha-de-app-de-16-digitos'
|
||||
# --from-literal=app_password='sua-senha-de-app-de-16-digitos'
|
||||
|
||||
Reference in New Issue
Block a user