unhide alert rule's data sources during migraiton (#48559)

This commit is contained in:
Yuriy Tseretyan 2022-05-04 09:31:05 -04:00 committed by GitHub
parent 7b4bc3eda6
commit f85e758972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -160,6 +160,8 @@ func migrateAlertRuleQueries(data []alertQuery) ([]alertQuery, error) {
if err != nil {
return nil, err
}
// remove hidden tag from the query (if exists)
delete(fixedData, "hide")
fixedData = fixGraphiteReferencedSubQueries(fixedData)
updatedModel, err := json.Marshal(fixedData)
if err != nil {

View File

@ -25,6 +25,11 @@ func TestMigrateAlertRuleQueries(t *testing.T) {
input: simplejson.NewFromAny(map[string]interface{}{"target": "ahalfquery"}),
expected: `{"target":"ahalfquery"}`,
},
{
name: "when query was hidden, it removes the flag",
input: simplejson.NewFromAny(map[string]interface{}{"hide": true}),
expected: `{}`,
},
}
for _, tt := range tc {