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 = {
|
test_data = {
|
||||||
**metadata,
|
**metadata,
|
||||||
'workflow_name': 'test_pipeline',
|
'workflow_name': 'test_pipeline',
|
||||||
'schedule_name': 'test_schedule'
|
'schedule_name': 'test_schedule',
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
}
|
}
|
||||||
|
|
||||||
slot_manager.get = MagicMock(return_value=None)
|
slot_manager.get = MagicMock(return_value=None)
|
||||||
@@ -233,7 +234,8 @@ async def test_get_last_data_timestamp_not_none(slot_manager):
|
|||||||
test_data = {
|
test_data = {
|
||||||
**metadata,
|
**metadata,
|
||||||
'workflow_name': 'test_pipeline',
|
'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')
|
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)
|
result = await slot_manager.get_last_data_timestamp(test_data)
|
||||||
|
|
||||||
slot_manager.get.assert_called_once_with(
|
slot_manager.get.assert_called_once_with(
|
||||||
'notification_last_timestamp'
|
'notification_last_timestamp:test_mail_type'
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result == '2023-01-01 12:00:00'
|
assert result == '2023-01-01 12:00:00'
|
||||||
@@ -253,7 +255,8 @@ async def test_get_last_data_timestamp_error(slot_manager):
|
|||||||
test_data = {
|
test_data = {
|
||||||
**metadata,
|
**metadata,
|
||||||
'workflow_name': 'test_pipeline',
|
'workflow_name': 'test_pipeline',
|
||||||
'schedule_name': 'test_schedule'
|
'schedule_name': 'test_schedule',
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
}
|
}
|
||||||
|
|
||||||
slot_manager.send_notification = MagicMock()
|
slot_manager.send_notification = MagicMock()
|
||||||
@@ -286,7 +289,8 @@ async def test_put_last_data_timestamp_empty_dataframe(slot_manager):
|
|||||||
**metadata,
|
**metadata,
|
||||||
'workflow_name': 'test_pipeline',
|
'workflow_name': 'test_pipeline',
|
||||||
'schedule_name': 'test_schedule',
|
'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()
|
slot_manager.set = MagicMock()
|
||||||
@@ -311,7 +315,8 @@ async def test_put_last_data_timestamp_not_empty_dataframe(slot_manager):
|
|||||||
**metadata,
|
**metadata,
|
||||||
'workflow_name': 'test_pipeline',
|
'workflow_name': 'test_pipeline',
|
||||||
'schedule_name': 'test_schedule',
|
'schedule_name': 'test_schedule',
|
||||||
'data': data.to_dict('records')
|
'data': data.to_dict('records'),
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
}
|
}
|
||||||
|
|
||||||
slot_manager.set = MagicMock()
|
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'
|
assert result == '2023-01-01 12:00:01'
|
||||||
|
|
||||||
slot_manager.set.assert_called_once_with(
|
slot_manager.set.assert_called_once_with(
|
||||||
'notification_last_timestamp',
|
'notification_last_timestamp:test_mail_type',
|
||||||
'2023-01-01 12:00:01',
|
'2023-01-01 12:00:01',
|
||||||
ttl=18000
|
ttl=18000
|
||||||
)
|
)
|
||||||
@@ -338,7 +343,8 @@ async def test_put_last_data_timestamp_error(slot_manager):
|
|||||||
'name': ['sensor1', 'sensor2'],
|
'name': ['sensor1', 'sensor2'],
|
||||||
'value': [25.5, 30.0],
|
'value': [25.5, 30.0],
|
||||||
'timestamp': ['2023-01-01 12:00:00'] * 2
|
'timestamp': ['2023-01-01 12:00:00'] * 2
|
||||||
}).to_dict('records')
|
}).to_dict('records'),
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
}
|
}
|
||||||
|
|
||||||
slot_manager.send_notification = MagicMock()
|
slot_manager.send_notification = MagicMock()
|
||||||
@@ -401,7 +407,8 @@ async def test_filter_notification_alerts(slot_manager):
|
|||||||
'contents': ['core_alerts']
|
'contents': ['core_alerts']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'notification_ttl': 300
|
'notification_ttl': 300,
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
}
|
}
|
||||||
|
|
||||||
response = await slot_manager.filter_notification_alerts(input_data)
|
response = await slot_manager.filter_notification_alerts(input_data)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ metadata = {
|
|||||||
async def test_run(workflow_mock, load_notification_package):
|
async def test_run(workflow_mock, load_notification_package):
|
||||||
input_data = {
|
input_data = {
|
||||||
'metadata': metadata,
|
'metadata': metadata,
|
||||||
|
'mail_type': 'test_mail_type',
|
||||||
'base_data_filter': {
|
'base_data_filter': {
|
||||||
'level': 'ERROR'
|
'level': 'ERROR'
|
||||||
}
|
}
|
||||||
@@ -62,7 +63,10 @@ async def test_run(workflow_mock, load_notification_package):
|
|||||||
workflow_mock.start_local_activity_method.assert_has_calls([
|
workflow_mock.start_local_activity_method.assert_has_calls([
|
||||||
call(
|
call(
|
||||||
Activities.get_last_data_timestamp,
|
Activities.get_last_data_timestamp,
|
||||||
input_data['metadata'],
|
{
|
||||||
|
**input_data['metadata'],
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
|
},
|
||||||
start_to_close_timeout=ANY,
|
start_to_close_timeout=ANY,
|
||||||
retry_policy=ANY
|
retry_policy=ANY
|
||||||
)
|
)
|
||||||
@@ -110,7 +114,8 @@ async def test_run(workflow_mock, load_notification_package):
|
|||||||
{
|
{
|
||||||
'id': '1',
|
'id': '1',
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
},
|
},
|
||||||
start_to_close_timeout=ANY,
|
start_to_close_timeout=ANY,
|
||||||
retry_policy=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):
|
async def test_run_no_data(workflow_mock, load_notification_package):
|
||||||
input_data = {
|
input_data = {
|
||||||
'metadata': metadata,
|
'metadata': metadata,
|
||||||
|
'mail_type': 'test_mail_type',
|
||||||
'base_data_filter': {
|
'base_data_filter': {
|
||||||
'level': 'ERROR'
|
'level': 'ERROR'
|
||||||
}
|
}
|
||||||
@@ -152,7 +158,8 @@ async def test_run_no_data(workflow_mock, load_notification_package):
|
|||||||
'metadata': metadata,
|
'metadata': metadata,
|
||||||
'base_data_filter': {
|
'base_data_filter': {
|
||||||
'level': 'ERROR'
|
'level': 'ERROR'
|
||||||
}
|
},
|
||||||
|
'mail_type': 'test_mail_type'
|
||||||
}
|
}
|
||||||
|
|
||||||
workflow_mock.start_local_activity_method.side_effect = [
|
workflow_mock.start_local_activity_method.side_effect = [
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ env:
|
|||||||
- name: GITHUB_REPO_URL
|
- name: GITHUB_REPO_URL
|
||||||
value: "git@github.com:Aignosi/sientia-dataops-orchestrator_temporal.git"
|
value: "git@github.com:Aignosi/sientia-dataops-orchestrator_temporal.git"
|
||||||
- name: GITHUB_BRANCH
|
- name: GITHUB_BRANCH
|
||||||
value: "SIENTIAPDE-1171-criar-pipeline-de-retreino-laborious"
|
value: "SIENTIAPDE-1172-criar-pipeline-de-alertas-orquestrador"
|
||||||
- name: PYTHON_APP
|
- name: PYTHON_APP
|
||||||
value: "orchestrator.worker.worker"
|
value: "orchestrator.worker.worker"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user