Alerting: replace usage of simplejson to json.RawMessage in NotificationChannelConfig (#60423)
* introduce alias for json.RawMessage with name RawMessage. This is needed to keep raw JSON and implement a marshaler for YAML, which does not seem to be used but there are tests that fail. * replace usage of simplejson with RawMessage in NotificationChannelConfig * remove usage of simplejson in tests * change migration code to convert simplejson to raw message
This commit is contained in:
@@ -3,14 +3,14 @@ package api
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
amConfig "github.com/prometheus/alertmanager/config"
|
||||
"github.com/prometheus/alertmanager/pkg/labels"
|
||||
"github.com/prometheus/alertmanager/timeinterval"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
)
|
||||
|
||||
func TestCheckRoute(t *testing.T) {
|
||||
@@ -319,9 +319,9 @@ func defaultGettableReceiver(t *testing.T, uid string, provenance models.Provena
|
||||
SecureFields: map[string]bool{
|
||||
"url": true,
|
||||
},
|
||||
Settings: simplejson.NewFromAny(map[string]interface{}{
|
||||
"hello": "world",
|
||||
}),
|
||||
Settings: definitions.RawMessage(`{
|
||||
"hello": "world"
|
||||
}`),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -338,9 +338,9 @@ func defaultPostableReceiver(t *testing.T, uid string) *definitions.PostableApiR
|
||||
Name: "yeah",
|
||||
Type: "slack",
|
||||
DisableResolveMessage: true,
|
||||
Settings: simplejson.NewFromAny(map[string]interface{}{
|
||||
"hello": "world",
|
||||
}),
|
||||
Settings: definitions.RawMessage(`{
|
||||
"hello": "world"
|
||||
}`),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user