Make alert test correctly show "ALERT_TEST" as the failing check

This commit is contained in:
Frank Hamand 2017-05-04 17:37:04 +01:00
parent f539ee63fa
commit d0eefc60e7
1 changed files with 9 additions and 1 deletions

View File

@ -702,11 +702,19 @@ class AlertTestView(LoginRequiredMixin, View):
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()