remove compat

the construction is about to become more complex in future
pull/107808/head
Yuri Tseretyan 2 weeks ago
parent bafc06ab31
commit 012419d925
  1. 14
      pkg/services/ngalert/remote/alertmanager_test.go
  2. 13
      pkg/services/ngalert/remote/compat.go

@ -363,12 +363,18 @@ func TestCompareAndSendConfiguration(t *testing.T) {
test, err := notifier.Load([]byte(testGrafanaConfigWithSecret))
require.NoError(t, err)
cfgWithDecryptedSecret := PostableUserConfigToGrafanaAlertmanagerConfig(test)
cfgWithDecryptedSecret := client.GrafanaAlertmanagerConfig{
TemplateFiles: test.TemplateFiles,
AlertmanagerConfig: test.AlertmanagerConfig,
}
testAutogenRoutes, err := notifier.Load([]byte(testGrafanaConfigWithSecret))
require.NoError(t, err)
require.NoError(t, testAutogenFn(nil, nil, 0, &testAutogenRoutes.AlertmanagerConfig, false))
cfgWithAutogenRoutes := PostableUserConfigToGrafanaAlertmanagerConfig(testAutogenRoutes)
cfgWithAutogenRoutes := client.GrafanaAlertmanagerConfig{
TemplateFiles: testAutogenRoutes.TemplateFiles,
AlertmanagerConfig: testAutogenRoutes.AlertmanagerConfig,
}
// Calculate hashes for expected configurations
cfgWithDecryptedSecretBytes, err := json.Marshal(cfgWithDecryptedSecret)
@ -433,7 +439,7 @@ func TestCompareAndSendConfiguration(t *testing.T) {
string(testGrafanaConfigWithEncryptedSecret),
NoopAutogenFn,
&client.UserGrafanaConfig{
GrafanaAlertmanagerConfig: cfgWithDecryptedSecret,
GrafanaAlertmanagerConfig: &cfgWithDecryptedSecret,
Hash: cfgWithDecryptedSecretHash,
},
nil,
@ -443,7 +449,7 @@ func TestCompareAndSendConfiguration(t *testing.T) {
string(testGrafanaConfigWithEncryptedSecret),
testAutogenFn,
&client.UserGrafanaConfig{
GrafanaAlertmanagerConfig: cfgWithAutogenRoutes,
GrafanaAlertmanagerConfig: &cfgWithAutogenRoutes,
Hash: cfgWithAutogenRoutesHash,
},
nil,

@ -1,13 +0,0 @@
package remote
import (
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/services/ngalert/remote/client"
)
func PostableUserConfigToGrafanaAlertmanagerConfig(config *definitions.PostableUserConfig) *client.GrafanaAlertmanagerConfig {
return &client.GrafanaAlertmanagerConfig{
TemplateFiles: config.TemplateFiles,
AlertmanagerConfig: config.AlertmanagerConfig,
}
}
Loading…
Cancel
Save