alerting: no notification when going from nodata -> pending (#16905)

ref #16496
This commit is contained in:
Carl Bergquist
2019-05-07 10:34:00 +02:00
committed by GitHub
parent b8674f4ec1
commit f001815d9d
3 changed files with 76 additions and 62 deletions
+6 -6
View File
@@ -6,6 +6,8 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/grafana/grafana/pkg/models"
)
@@ -195,12 +197,10 @@ func TestGetStateFromEvalContext(t *testing.T) {
}
for _, tc := range tcs {
ctx := NewEvalContext(context.TODO(), &Rule{Conditions: []Condition{&conditionStub{firing: true}}})
evalContext := NewEvalContext(context.Background(), &Rule{Conditions: []Condition{&conditionStub{firing: true}}})
tc.applyFn(ctx)
have := ctx.GetNewState()
if have != tc.expected {
t.Errorf("failed: %s \n expected '%s' have '%s'\n", tc.name, tc.expected, string(have))
}
tc.applyFn(evalContext)
newState := evalContext.GetNewState()
assert.Equal(t, tc.expected, newState, "failed: %s \n expected '%s' have '%s'\n", tc.name, tc.expected, string(newState))
}
}