diff --git a/pkg/services/alerting/notifiers/base_test.go b/pkg/services/alerting/notifiers/base_test.go index 8e527906cfd..8cfc1ec3ae9 100644 --- a/pkg/services/alerting/notifiers/base_test.go +++ b/pkg/services/alerting/notifiers/base_test.go @@ -1,30 +1,30 @@ package notifiers -import . "github.com/smartystreets/goconvey/convey" - -func TestBaseNotifier( /* t *testing.T */ ) { - // Convey("Parsing base notification state", t, func() { - // - // Convey("matches", func() { - // json := ` - // { - // "states": "critical" - // }` - // - // settingsJSON, _ := simplejson.NewJson([]byte(json)) - // not := NewNotifierBase("ops", "email", settingsJSON) - // So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue) - // }) - // - // Convey("does not match", func() { - // json := ` - // { - // "severityFilter": "critical" - // }` - // - // settingsJSON, _ := simplejson.NewJson([]byte(json)) - // not := NewNotifierBase("ops", "email", settingsJSON) - // So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse) - // }) - // }) -} +// import . "github.com/smartystreets/goconvey/convey" +// +// func TestBaseNotifier( t *testing.T ) { +// Convey("Parsing base notification state", t, func() { +// +// Convey("matches", func() { +// json := ` +// { +// "states": "critical" +// }` +// +// settingsJSON, _ := simplejson.NewJson([]byte(json)) +// not := NewNotifierBase("ops", "email", settingsJSON) +// So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue) +// }) +// +// Convey("does not match", func() { +// json := ` +// { +// "severityFilter": "critical" +// }` +// +// settingsJSON, _ := simplejson.NewJson([]byte(json)) +// not := NewNotifierBase("ops", "email", settingsJSON) +// So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse) +// }) +// }) +// } diff --git a/pkg/services/alerting/test_notification.go b/pkg/services/alerting/test_notification.go index c483835b8e1..de2cb981aaa 100644 --- a/pkg/services/alerting/test_notification.go +++ b/pkg/services/alerting/test_notification.go @@ -35,38 +35,34 @@ func handleNotificationTestCommand(cmd *NotificationTestCommand) error { return err } - notifier.sendNotifications([]Notifier{notifiers}, createTestEvalContext(cmd.State)) + notifier.sendNotifications([]Notifier{notifiers}, createTestEvalContext()) return nil } -func createTestEvalContext(state m.AlertStateType) *EvalContext { +func createTestEvalContext() *EvalContext { testRule := &Rule{ DashboardId: 1, PanelId: 1, Name: "Test notification", Message: "Someone is testing the alert notification within grafana.", - State: state, + State: m.AlertStateAlerting, } ctx := NewEvalContext(testRule) ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png" ctx.IsTestRun = true - ctx.Firing = state == m.AlertStateAlerting + ctx.Firing = true ctx.Error = nil - ctx.EvalMatches = evalMatchesBasedOnState(state) + ctx.EvalMatches = evalMatchesBasedOnState() return ctx } -func evalMatchesBasedOnState(state m.AlertStateType) []*EvalMatch { +func evalMatchesBasedOnState() []*EvalMatch { matches := make([]*EvalMatch, 0) - if state == m.AlertStateOK { - return matches - } - matches = append(matches, &EvalMatch{ Metric: "High value", Value: 100, diff --git a/public/app/features/alerting/notification_edit_ctrl.ts b/public/app/features/alerting/notification_edit_ctrl.ts index 3ef9e822333..de5703a0631 100644 --- a/public/app/features/alerting/notification_edit_ctrl.ts +++ b/public/app/features/alerting/notification_edit_ctrl.ts @@ -62,7 +62,6 @@ export class AlertNotificationEditCtrl { name: this.model.name, type: this.model.type, settings: this.model.settings, - severity: this.testSeverity }; this.backendSrv.post(`/api/alert-notifications/test`, payload) diff --git a/public/app/features/alerting/partials/notification_edit.html b/public/app/features/alerting/partials/notification_edit.html index 59f4607a2e7..65964b2c7c4 100644 --- a/public/app/features/alerting/partials/notification_edit.html +++ b/public/app/features/alerting/partials/notification_edit.html @@ -25,15 +25,6 @@ -
- Severity filter -
- -
-
-
- Severity for test notification -
- -
-