mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 02:23:31 -06:00
* Alerting: Create fewer contact points on migration Previously a new contact point was created for every unique combination of channels attached to any legacy alert. This was very hard to maintain, requiring modifications in every generated contact point. This change deduplicates the generated contact points to a more reasonable state. There should now only be one contact point per legacy channel, and we attached multiple contact points to a route by nesting them. The sole exception to this is if there were multiple default legacy channels, in which case we create a redundant contact point containing all of them used only in the root policy. This allows for a much simpler notification policy structure. Co-authored-by: gotjosh <josue.abreu@gmail.com>
22 lines
404 B
Go
22 lines
404 B
Go
package ualert
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/log"
|
|
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
)
|
|
|
|
// newTestMigration generates an empty migration to use in tests.
|
|
func newTestMigration(t *testing.T) *migration {
|
|
t.Helper()
|
|
|
|
return &migration{
|
|
mg: &migrator.Migrator{
|
|
|
|
Logger: log.New("test"),
|
|
},
|
|
seenChannelUIDs: make(map[string]struct{}),
|
|
}
|
|
}
|