Alerting: Hook up GMA silence APIs to new authentication handler (#86625)

This PR connects the new RBAC authentication service to existing alertmanager API silence endpoints.
This commit is contained in:
Matthew Jacobson
2024-05-03 15:32:30 -04:00
committed by GitHub
parent e9b932c8f6
commit babfa2beac
25 changed files with 1192 additions and 230 deletions
@@ -1996,13 +1996,18 @@ func TestIntegrationAlertmanagerCreateSilence(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
silenceID, err := client.PostSilence(t, tc.silence)
silenceOkBody, status, body := client.PostSilence(t, tc.silence)
t.Log(body)
if tc.expErr != "" {
require.EqualError(t, err, tc.expErr)
require.Empty(t, silenceID)
assert.NotEqual(t, http.StatusAccepted, status)
var validationError errutil.PublicError
assert.NoError(t, json.Unmarshal([]byte(body), &validationError))
assert.Contains(t, validationError.Message, tc.expErr)
assert.Empty(t, silenceOkBody.SilenceID)
} else {
require.NoError(t, err)
require.NotEmpty(t, silenceID)
assert.Equal(t, http.StatusAccepted, status)
assert.NotEmpty(t, silenceOkBody.SilenceID)
}
})
}