tech(alerting): expression -> settings

This commit is contained in:
bergquist
2016-06-13 15:18:19 +02:00
parent bb6888885e
commit 7f22b9eb6e
6 changed files with 20 additions and 20 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ type Alert struct {
Created time.Time
Updated time.Time
Expression *simplejson.Json
Settings *simplejson.Json
}
func (alert *Alert) ValidToSave() bool {
@@ -32,9 +32,9 @@ func (this *Alert) ContainsUpdates(other *Alert) bool {
result = result || this.Name != other.Name
result = result || this.Description != other.Description
if this.Expression != nil && other.Expression != nil {
json1, err1 := this.Expression.Encode()
json2, err2 := other.Expression.Encode()
if this.Settings != nil && other.Settings != nil {
json1, err1 := this.Settings.Encode()
json2, err2 := other.Settings.Encode()
if err1 != nil || err2 != nil {
return false
+3 -3
View File
@@ -14,13 +14,13 @@ func TestAlertingModelTest(t *testing.T) {
json2, _ := simplejson.NewJson([]byte(`{ "field": "value" }`))
rule1 := &Alert{
Expression: json1,
Settings: json1,
Name: "Namn",
Description: "Description",
}
rule2 := &Alert{
Expression: json2,
Settings: json2,
Name: "Namn",
Description: "Description",
}
@@ -32,7 +32,7 @@ func TestAlertingModelTest(t *testing.T) {
Convey("Changing the expression should contain update", func() {
json2, _ := simplejson.NewJson([]byte(`{ "field": "newValue" }`))
rule1.Expression = json2
rule1.Settings = json2
So(rule1.ContainsUpdates(rule2), ShouldBeTrue)
})
})