Alerting: Update rule access control to return errutil errors (#78284)

* update rule access control to return errutil errors
* use alerting in msgID
This commit is contained in:
Yuri Tseretyan
2023-12-01 18:42:11 -05:00
committed by GitHub
parent 6644e5e676
commit 64feeddc23
12 changed files with 187 additions and 102 deletions
@@ -1051,7 +1051,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
}(),
expectedMessage: func() string {
if setting.IsEnterprise {
return "user is not authorized to create a new alert rule 'AlwaysFiring' because the user does not have read permissions for one or many datasources the rule uses"
return "user is not authorized to create a new alert rule 'AlwaysFiring'"
}
return "failed to update rule group: invalid alert rule 'AlwaysFiring': failed to build query 'A': data source not found"
}(),
@@ -2284,7 +2284,7 @@ func TestIntegrationEval(t *testing.T) {
},
expectedMessage: func() string {
if setting.IsEnterprise {
return "user is not authorized to query one or many data sources used by the rule"
return "user is not authorized to access one or many data sources"
}
return "Failed to build evaluator for queries and expressions: failed to build query 'A': data source not found"
},