fix(api): always sort shared silences

Prevent different order between requests, which can also break random tests
This commit is contained in:
Łukasz Mierzwa
2019-03-15 13:27:03 +00:00
parent 430ec7851d
commit 003e2d88ac

View File

@@ -2,6 +2,7 @@ package models
import (
"fmt"
"sort"
"github.com/prymitive/karma/internal/slices"
)
@@ -179,6 +180,8 @@ func (ag *APIAlertGroup) dedupSilences() {
ag.Shared.Silences[cluster] = []string{}
}
ag.Shared.Silences[cluster] = append(ag.Shared.Silences[cluster], silenceID)
// sort to have stable order of silences
sort.Strings(ag.Shared.Silences[cluster])
}
}
}