mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Do not update rule in database if it was not changed (#45980)
* do not include update if no diff * refactor calculate changes to include diff (and log) Co-authored-by: George Robinson <george.robinson@grafana.com>
This commit is contained in:
@@ -1787,7 +1787,7 @@ func TestAlertRuleCRUD(t *testing.T) {
|
||||
}`, body)
|
||||
}
|
||||
|
||||
// update the rule; keep title, condition, no data state, error state, queries and expressions if not provided
|
||||
// update the rule; keep title, condition, no data state, error state, queries and expressions if not provided. should be noop
|
||||
{
|
||||
rules := apimodels.PostableRuleGroupConfig{
|
||||
Name: "arulegroup",
|
||||
@@ -1817,7 +1817,7 @@ func TestAlertRuleCRUD(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, resp.StatusCode, 202)
|
||||
require.JSONEq(t, `{"message":"rule group updated successfully"}`, string(b))
|
||||
require.JSONEq(t, `{"message":"no changes detected in the rule group"}`, string(b))
|
||||
|
||||
// let's make sure that rule definitions are updated correctly.
|
||||
u = fmt.Sprintf("http://grafana:password@%s/api/ruler/grafana/api/v1/rules/default", grafanaListedAddr)
|
||||
@@ -1872,7 +1872,7 @@ func TestAlertRuleCRUD(t *testing.T) {
|
||||
],
|
||||
"updated":"2021-02-21T01:10:30Z",
|
||||
"intervalSeconds":60,
|
||||
"version":4,
|
||||
"version":3,
|
||||
"uid":"uid",
|
||||
"namespace_uid":"nsuid",
|
||||
"namespace_id":1,
|
||||
|
||||
Reference in New Issue
Block a user