Alerting: Add feature toggle to use the old simplified routing hash generation (#111900)
* Revert "Alerting: Generate simplified routing routes with old fingerprint function (#111893)"
This reverts commit 0da9d49896.
* Add alertingUseNewSimplifiedRoutingHashAlgorithm flag
* Alerting: Add feature toggle to use the old simplified routing hash generation
This commit is contained in:
@@ -291,7 +291,8 @@ func TestAlertmanagerAutogenConfig(t *testing.T) {
|
||||
1: {AlertmanagerConfiguration: validConfig, OrgID: 1},
|
||||
2: {AlertmanagerConfiguration: validConfigWithoutAutogen, OrgID: 2},
|
||||
}
|
||||
sut.mam = createMultiOrgAlertmanager(t, configs)
|
||||
ft := featuremgmt.WithFeatures(featuremgmt.FlagAlertingUseNewSimplifiedRoutingHashAlgorithm)
|
||||
sut.mam = createMultiOrgAlertmanager(t, configs, withAMFeatureToggles(ft))
|
||||
return sut, configs
|
||||
}
|
||||
|
||||
@@ -577,9 +578,29 @@ func createSut(t *testing.T) AlertmanagerSrv {
|
||||
}
|
||||
}
|
||||
|
||||
func createMultiOrgAlertmanager(t *testing.T, configs map[int64]*ngmodels.AlertConfiguration) *notifier.MultiOrgAlertmanager {
|
||||
type createMultiOrgAMOptions struct {
|
||||
featureToggles featuremgmt.FeatureToggles
|
||||
}
|
||||
|
||||
type createMultiOrgAMOptionsFunc func(*createMultiOrgAMOptions)
|
||||
|
||||
func withAMFeatureToggles(toggles featuremgmt.FeatureToggles) createMultiOrgAMOptionsFunc {
|
||||
return func(opts *createMultiOrgAMOptions) {
|
||||
opts.featureToggles = toggles
|
||||
}
|
||||
}
|
||||
|
||||
func createMultiOrgAlertmanager(t *testing.T, configs map[int64]*ngmodels.AlertConfiguration, opts ...createMultiOrgAMOptionsFunc) *notifier.MultiOrgAlertmanager {
|
||||
t.Helper()
|
||||
|
||||
options := createMultiOrgAMOptions{
|
||||
featureToggles: featuremgmt.WithFeatures(),
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(&options)
|
||||
}
|
||||
|
||||
configStore := notifier.NewFakeConfigStore(t, configs)
|
||||
orgStore := notifier.NewFakeOrgStore(t, []int64{1, 2, 3})
|
||||
provStore := ngfakes.NewFakeProvisioningStore()
|
||||
@@ -610,7 +631,7 @@ func createMultiOrgAlertmanager(t *testing.T, configs map[int64]*ngmodels.AlertC
|
||||
ngfakes.NewFakeReceiverPermissionsService(),
|
||||
log.New("testlogger"),
|
||||
secretsService,
|
||||
featuremgmt.WithManager(),
|
||||
options.featureToggles,
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user