|
@@ -30,6 +30,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, true)
|
|
So(context.Firing, ShouldEqual, true)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "true = true")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return false with not passing asdf", func() {
|
|
Convey("Show return false with not passing asdf", func() {
|
|
@@ -42,6 +43,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, false)
|
|
So(context.Firing, ShouldEqual, false)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[true AND false] = false")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return true if any of the condition is passing with OR operator", func() {
|
|
Convey("Show return true if any of the condition is passing with OR operator", func() {
|
|
@@ -54,6 +56,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, true)
|
|
So(context.Firing, ShouldEqual, true)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[true OR false] = true")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return false if any of the condition is failing with AND operator", func() {
|
|
Convey("Show return false if any of the condition is failing with AND operator", func() {
|
|
@@ -66,6 +69,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, false)
|
|
So(context.Firing, ShouldEqual, false)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[true AND false] = false")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return true if one condition is failing with nested OR operator", func() {
|
|
Convey("Show return true if one condition is failing with nested OR operator", func() {
|
|
@@ -79,6 +83,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, true)
|
|
So(context.Firing, ShouldEqual, true)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[[true AND true] OR false] = true")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return false if one condition is passing with nested OR operator", func() {
|
|
Convey("Show return false if one condition is passing with nested OR operator", func() {
|
|
@@ -92,6 +97,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, false)
|
|
So(context.Firing, ShouldEqual, false)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[[true AND false] OR false] = false")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return false if a condition is failing with nested AND operator", func() {
|
|
Convey("Show return false if a condition is failing with nested AND operator", func() {
|
|
@@ -105,6 +111,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, false)
|
|
So(context.Firing, ShouldEqual, false)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[[true AND false] AND true] = false")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Show return true if a condition is passing with nested OR operator", func() {
|
|
Convey("Show return true if a condition is passing with nested OR operator", func() {
|
|
@@ -118,6 +125,7 @@ func TestAlertingExecutor(t *testing.T) {
|
|
|
|
|
|
|
|
handler.Eval(context)
|
|
handler.Eval(context)
|
|
|
So(context.Firing, ShouldEqual, true)
|
|
So(context.Firing, ShouldEqual, true)
|
|
|
|
|
+ So(context.FiringEval, ShouldEqual, "[[true OR false] OR true] = true")
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|