Просмотр исходного кода

don't write to notification journal when testing notifier/rule

Marcus Efraimsson 7 лет назад
Родитель
Сommit
dfa5d17670
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      pkg/services/alerting/notifier.go

+ 4 - 0
pkg/services/alerting/notifier.go

@@ -77,6 +77,10 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
 			//send notification
 			success := not.Notify(evalContext) == nil
 
+			if evalContext.IsTestRun {
+				return nil
+			}
+
 			//write result to db.
 			cmd := &m.RecordNotificationJournalCommand{
 				OrgId:      evalContext.Rule.OrgId,