SIENTIAPDE-1445

Refactor test cases in test_orchestrator_functions.py to consolidate read_tags structure and enhance clarity in API error handling, improving test robustness and readability.
This commit is contained in:
vitor-aignosi
2025-12-22 14:45:14 -03:00
parent 886c6362ce
commit 23c6b06868

View File

@@ -221,7 +221,15 @@ def test_predictions_batch(mock_process_path_priority, mock_overlap_filter_confi
[call({'EMPTY_DATA': {'policy': 'STOP', 'config': {}}}, config['input_filters'])] [call({'EMPTY_DATA': {'policy': 'STOP', 'config': {}}}, config['input_filters'])]
) )
mock_overlap_filter_config.assert_has_calls( mock_overlap_filter_config.assert_has_calls(
[call({'API_ERROR': {'policy': 'STOP', 'config': {}}}, config['mlflow_transform_filters'])] [
call(
{
'EMPTY_DATA': {'policy': 'STOP', 'config': {}},
'API_ERROR': {'policy': 'STOP', 'config': {}},
},
config['mlflow_transform_filters'],
)
]
) )
mock_overlap_filter_config.assert_has_calls( mock_overlap_filter_config.assert_has_calls(
[call({'API_ERROR': {'policy': 'STOP', 'config': {}}}, config['mlflow_predict_filters'])] [call({'API_ERROR': {'policy': 'STOP', 'config': {}}}, config['mlflow_predict_filters'])]
@@ -553,14 +561,13 @@ def test_pi_web_api_scouter():
'model_id': 'test_model_id', 'model_id': 'test_model_id',
'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}}, 'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}},
'filters': [{'filter_name': 'test_filter_name', 'policy': 'test_policy'}], 'filters': [{'filter_name': 'test_filter_name', 'policy': 'test_policy'}],
'read_tags': [ 'read_tags': {
{ 'test_tag_name': {
'tag_name': 'test_tag_name',
'webid': 'test_webid', 'webid': 'test_webid',
'aggr_func': 'test_aggr_func', 'aggr_func': 'test_aggr_func',
'data_range': [1, 2], 'data_range': [1, 2],
} }
], },
'tag_retention_minutes': 10, 'tag_retention_minutes': 10,
'pi_web_api_config': { 'pi_web_api_config': {
'endpoint': 'https://test-endpoint.com', 'endpoint': 'https://test-endpoint.com',
@@ -613,12 +620,11 @@ def test_pi_web_api_scouter_with_timeout_greater_than_frequency():
'model_id': 'test_model_id', 'model_id': 'test_model_id',
'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}}, 'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}},
'filters': [], 'filters': [],
'read_tags': [ 'read_tags': {
{ 'test_tag_name': {
'tag_name': 'test_tag_name',
'webid': 'test_webid', 'webid': 'test_webid',
} }
], },
'tag_retention_minutes': 10, 'tag_retention_minutes': 10,
'pi_web_api_config': { 'pi_web_api_config': {
'endpoint': 'https://test-endpoint.com', 'endpoint': 'https://test-endpoint.com',
@@ -665,12 +671,11 @@ def test_pi_web_api_scouter_with_no_timeout():
'model_id': 'test_model_id', 'model_id': 'test_model_id',
'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}}, 'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}},
'filters': [], 'filters': [],
'read_tags': [ 'read_tags': {
{ 'test_tag_name': {
'tag_name': 'test_tag_name',
'webid': 'test_webid', 'webid': 'test_webid',
} }
], },
'tag_retention_minutes': 10, 'tag_retention_minutes': 10,
'pi_web_api_config': { 'pi_web_api_config': {
'endpoint': 'https://test-endpoint.com', 'endpoint': 'https://test-endpoint.com',