Alerting: Migrate to integration schema (#111643)
* update tests to assert against snapshot * remove channel_config package replaced by schemas from alerting module * update references to use new schema
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/notifier/channels_config"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/tests/testinfra"
|
||||
@@ -54,10 +53,17 @@ func TestIntegrationAvailableChannels(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 200, resp.StatusCode)
|
||||
|
||||
expNotifiers := channels_config.GetAvailableNotifiers()
|
||||
expJson, err := json.Marshal(expNotifiers)
|
||||
expectedBytes, err := os.ReadFile(path.Join("test-data", "alert-notifiers-v1-snapshot.json"))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, string(expJson), string(b))
|
||||
|
||||
require.NoError(t, err)
|
||||
if !assert.JSONEq(t, string(expectedBytes), string(b)) {
|
||||
var prettyJSON bytes.Buffer
|
||||
err := json.Indent(&prettyJSON, b, "", " ")
|
||||
require.NoError(t, err)
|
||||
err = os.WriteFile(path.Join("test-data", "alert-notifiers-v1-snapshot.json"), prettyJSON.Bytes(), 0o644)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("should return versioned notifiers", func(t *testing.T) {
|
||||
|
||||
@@ -17,11 +17,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/alerting/receivers"
|
||||
alertingLine "github.com/grafana/alerting/receivers/line"
|
||||
alertingPushover "github.com/grafana/alerting/receivers/pushover"
|
||||
alertingSlack "github.com/grafana/alerting/receivers/slack"
|
||||
alertingTelegram "github.com/grafana/alerting/receivers/telegram"
|
||||
alertingThreema "github.com/grafana/alerting/receivers/threema"
|
||||
alertingLine "github.com/grafana/alerting/receivers/line/v1"
|
||||
alertingPushover "github.com/grafana/alerting/receivers/pushover/v1"
|
||||
alertingSlack "github.com/grafana/alerting/receivers/slack/v1"
|
||||
alertingTelegram "github.com/grafana/alerting/receivers/telegram/v1"
|
||||
alertingThreema "github.com/grafana/alerting/receivers/threema/v1"
|
||||
alertingTemplates "github.com/grafana/alerting/templates"
|
||||
"github.com/prometheus/alertmanager/template"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@
|
||||
"description": "Send notifications to LINE notify",
|
||||
"versions": [
|
||||
{
|
||||
"typeAlias": "line",
|
||||
"version": "v1",
|
||||
"canCreate": true,
|
||||
"options": [
|
||||
@@ -8143,7 +8144,7 @@
|
||||
"type": "sns",
|
||||
"currentVersion": "v1",
|
||||
"name": "AWS SNS",
|
||||
"heading": "Webex settings",
|
||||
"heading": "AWS SNS settings",
|
||||
"description": "Sends notifications to AWS Simple Notification Service",
|
||||
"versions": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user