mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
pagerduty: fixes invalid default value
autoResolve incident checkbox was set to disabled by default but the backend used enabled as default. This commit makes both use disabled by defualt fixes #10222
This commit is contained in:
parent
e480a38dc1
commit
7917efb31a
@ -42,7 +42,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
|
func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
|
||||||
autoResolve := model.Settings.Get("autoResolve").MustBool(true)
|
autoResolve := model.Settings.Get("autoResolve").MustBool(false)
|
||||||
key := model.Settings.Get("integrationKey").MustString()
|
key := model.Settings.Get("integrationKey").MustString()
|
||||||
if key == "" {
|
if key == "" {
|
||||||
return nil, alerting.ValidationError{Reason: "Could not find integration key property in settings"}
|
return nil, alerting.ValidationError{Reason: "Could not find integration key property in settings"}
|
||||||
|
@ -25,6 +25,26 @@ func TestPagerdutyNotifier(t *testing.T) {
|
|||||||
So(err, ShouldNotBeNil)
|
So(err, ShouldNotBeNil)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Convey("auto resolve should default to false", func() {
|
||||||
|
json := `{ "integrationKey": "abcdefgh0123456789" }`
|
||||||
|
|
||||||
|
settingsJSON, _ := simplejson.NewJson([]byte(json))
|
||||||
|
model := &m.AlertNotification{
|
||||||
|
Name: "pagerduty_testing",
|
||||||
|
Type: "pagerduty",
|
||||||
|
Settings: settingsJSON,
|
||||||
|
}
|
||||||
|
|
||||||
|
not, err := NewPagerdutyNotifier(model)
|
||||||
|
pagerdutyNotifier := not.(*PagerdutyNotifier)
|
||||||
|
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
So(pagerdutyNotifier.Name, ShouldEqual, "pagerduty_testing")
|
||||||
|
So(pagerdutyNotifier.Type, ShouldEqual, "pagerduty")
|
||||||
|
So(pagerdutyNotifier.Key, ShouldEqual, "abcdefgh0123456789")
|
||||||
|
So(pagerdutyNotifier.AutoResolve, ShouldBeFalse)
|
||||||
|
})
|
||||||
|
|
||||||
Convey("settings should trigger incident", func() {
|
Convey("settings should trigger incident", func() {
|
||||||
json := `
|
json := `
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user