Skip to content

Commit

Permalink
Make alert test correctly show "ALERT_TEST" as the failing check
Browse files Browse the repository at this point in the history
  • Loading branch information
frankh committed May 4, 2017
1 parent f539ee6 commit d0eefc6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cabot/cabotapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,19 @@ def trigger_alert_to_user(self, service, user, old_status, new_status):
with transaction.atomic():
sid = transaction.savepoint()
service.update_status()
service.status_checks.update(active=False)
service.overall_status = new_status
service.old_overall_status = old_status
service.last_alert_sent = None

check = StatusCheck(name='ALERT_TEST', calculated_status=service.overall_status)
check = StatusCheck(name='ALERT_TEST')
check.save()
StatusCheckResult.objects.create(
status_check=check,
time=timezone.now(),
time_complete=timezone.now(),
succeeded=new_status == Service.PASSING_STATUS)
check.last_run = timezone.now()
check.save()
service.status_checks.add(check)
service.users_to_notify.clear()
Expand Down

0 comments on commit d0eefc6

Please sign in to comment.