SIENTIAPDE-1174
Implement async test for write_metrics method in Gates activity, enhancing test coverage for metric logging functionality.
This commit is contained in:
@@ -402,3 +402,18 @@ async def test_aggregate_data_raise_exception(gates_fixture):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
@patch('scouter.activities.gates.metrics')
|
||||||
|
async def test_write_metrics(mock_metrics, gates_fixture):
|
||||||
|
"""Test write_metrics method."""
|
||||||
|
input_data = {
|
||||||
|
'metadata': metadata['metadata']
|
||||||
|
}
|
||||||
|
await gates_fixture.write_metrics(input_data)
|
||||||
|
mock_metrics.LABORIOUS_DATA_WRITTEN_COUNT.labels.assert_called_once_with(
|
||||||
|
pod_id=gates_fixture.pod_id,
|
||||||
|
model_name=metadata['metadata']['model_name'],
|
||||||
|
pipeline_name=metadata['metadata']['workflow_name']
|
||||||
|
)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ def redis_activity(_mock_redis_init):
|
|||||||
activity.redis_client = MagicMock()
|
activity.redis_client = MagicMock()
|
||||||
activity.logger = logger
|
activity.logger = logger
|
||||||
activity.notification_handler = notification_handler
|
activity.notification_handler = notification_handler
|
||||||
|
activity.pod_id = 'test_pod_id'
|
||||||
return activity
|
return activity
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user