mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Highlight failing jobs on the dashboard
> When we have jobs that have over 3% failure rates we should highlight > those so that peoples attention is drawn to deal with the failure. > > They would then go to the job view to see what the details are where > they could filter by failure, but that's a different story... > > This is just about calculating and highlighting those that need their > attention. — https://www.pivotaltracker.com/story/show/121206123 This commit: - calculates the failure rate for each job - makes jobs with a failure rate of > 3% go red on the dashboard
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from app.statistics_utils import sum_of_statistics, add_rates_to, statistics_by_state
|
||||
from app.statistics_utils import sum_of_statistics, add_rates_to, add_rate_to_jobs, statistics_by_state
|
||||
|
||||
|
||||
@pytest.mark.parametrize('delivery_statistics', [
|
||||
@@ -113,3 +113,25 @@ def test_service_statistics_by_state():
|
||||
assert resp[message_type]['sending'] == 1
|
||||
assert resp[message_type]['delivered'] == 1
|
||||
assert resp[message_type]['failed'] == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize('failed, delivered, expected_failure_rate', [
|
||||
(0, 0, 0),
|
||||
(0, 1, 0),
|
||||
(1, 0, 100),
|
||||
(1, 4, 20)
|
||||
])
|
||||
def test_add_rate_to_jobs(failed, delivered, expected_failure_rate):
|
||||
resp = add_rate_to_jobs([
|
||||
{
|
||||
'notifications_failed': failed,
|
||||
'notifications_delivered': delivered
|
||||
},
|
||||
{
|
||||
'notifications_failed': 1,
|
||||
'notifications_delivered': 1
|
||||
}
|
||||
])
|
||||
|
||||
assert resp[0]['failure_rate'] == expected_failure_rate
|
||||
assert resp[1]['failure_rate'] == 50
|
||||
|
||||
Reference in New Issue
Block a user