[Alerting] Ensure upstream validations are run (#34333)
* use embedded validations via noop yaml unmarshaler * lint * fixes integration tests now that groupings are handled
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v3"
|
||||
@@ -563,3 +564,14 @@ func Test_ReceiverMatchesBackend(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Marshaling_Validation(t *testing.T) {
|
||||
jsonEncoded, err := ioutil.ReadFile("alertmanager_test_artifact.json")
|
||||
require.Nil(t, err)
|
||||
|
||||
var tmp GettableUserConfig
|
||||
require.Nil(t, json.Unmarshal(jsonEncoded, &tmp))
|
||||
|
||||
expected := []model.LabelName{"alertname"}
|
||||
require.Equal(t, expected, tmp.AlertmanagerConfig.Config.Route.GroupBy)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user