Alerting: Export rule validation logic and make it portable (#83555)
* ValidateInterval doesn't need the entire config * Validation no longer depends on entire folder now that we've dropped foldertitle from api * Don't depend on entire config struct * Export validate group
This commit is contained in:
@@ -66,8 +66,8 @@ func (srv TestingApiSrv) RouteTestGrafanaRuleConfig(c *contextmodel.ReqContext,
|
||||
body.RuleGroup,
|
||||
srv.cfg.BaseInterval,
|
||||
c.SignedInUser.GetOrgID(),
|
||||
folder,
|
||||
srv.cfg,
|
||||
folder.UID,
|
||||
RuleLimitsFromConfig(srv.cfg),
|
||||
)
|
||||
if err != nil {
|
||||
return ErrResp(http.StatusBadRequest, err, "")
|
||||
@@ -238,7 +238,7 @@ func (srv TestingApiSrv) BacktestAlertRule(c *contextmodel.ReqContext, cmd apimo
|
||||
return ErrResp(400, nil, "Bad For interval")
|
||||
}
|
||||
|
||||
intervalSeconds, err := validateInterval(srv.cfg, time.Duration(cmd.Interval))
|
||||
intervalSeconds, err := validateInterval(time.Duration(cmd.Interval), srv.cfg.BaseInterval)
|
||||
if err != nil {
|
||||
return ErrResp(400, err, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user