result_handler_test.go 761 B

123456789101112131415161718192021222324252627282930
  1. package alerting
  2. // import (
  3. // "context"
  4. // "testing"
  5. //
  6. // "github.com/grafana/grafana/pkg/models"
  7. // . "github.com/smartystreets/goconvey/convey"
  8. // )
  9. //
  10. // func TestAlertResultHandler(t *testing.T) {
  11. // Convey("Test result Handler", t, func() {
  12. //
  13. // handler := NewResultHandler()
  14. // evalContext := NewEvalContext(context.TODO(), &Rule{})
  15. //
  16. // Convey("Should update", func() {
  17. //
  18. // Convey("when no earlier alert state", func() {
  19. // oldState := models.AlertStateOK
  20. //
  21. // evalContext.Rule.State = models.AlertStateAlerting
  22. // evalContext.Rule.NoDataState = models.NoDataKeepState
  23. // evalContext.NoDataFound = true
  24. //
  25. // So(handler.shouldUpdateAlertState(evalContext, oldState), ShouldBeFalse)
  26. // })
  27. // })
  28. // })
  29. // }