Skip to content

Commit

Permalink
Fix integration test for retrieving AM config as admin
Browse files Browse the repository at this point in the history
config includes generated routes by default now.
  • Loading branch information
JacobsonMT committed Mar 20, 2024
1 parent 7cff788 commit 07b9cba
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion pkg/tests/api/alerting/api_alertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,40 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
}
}
`
cfgBodyWithAutogen := `
{
"template_files": null,
"alertmanager_config": {
"route": {
"receiver": "grafana-default-email",
"routes": [{
"receiver": "grafana-default-email",
"object_matchers": [["__grafana_autogenerated__", "=", "true"]],
"routes": [{
"receiver": "grafana-default-email",
"group_by": ["grafana_folder", "alertname"],
"object_matchers": [["__grafana_receiver__", "=", "grafana-default-email"]]
}]
}]
},
"templates": null,
"receivers": [{
"name": "grafana-default-email",
"grafana_managed_receiver_configs": [{
"disableResolveMessage": false,
"uid": "",
"name": "email receiver",
"type": "email",
"secureFields": {},
"settings": {
"addresses": "<example@email.com>"
}
}]
}]
}
}
`
testCases := []testCase{
{
desc: "un-authenticated request should fail",
Expand All @@ -192,7 +226,7 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
desc: "admin request should succeed",
url: "http://admin:admin@%s/api/alertmanager/grafana/config/api/v1/alerts",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgBodyWithAutogen,
},
}

Expand Down

0 comments on commit 07b9cba

Please sign in to comment.