alert_rule_test.go 692 B

1234567891011121314151617181920212223242526272829303132
  1. package alerting
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestAlertRuleModel(t *testing.T) {
  7. Convey("Testing alert rule", t, func() {
  8. Convey("Can parse seconds", func() {
  9. seconds := getTimeDurationStringToSeconds("10s")
  10. So(seconds, ShouldEqual, 10)
  11. })
  12. Convey("Can parse minutes", func() {
  13. seconds := getTimeDurationStringToSeconds("10m")
  14. So(seconds, ShouldEqual, 600)
  15. })
  16. Convey("Can parse hours", func() {
  17. seconds := getTimeDurationStringToSeconds("1h")
  18. So(seconds, ShouldEqual, 3600)
  19. })
  20. Convey("defaults to seconds", func() {
  21. seconds := getTimeDurationStringToSeconds("1o")
  22. So(seconds, ShouldEqual, 1)
  23. })
  24. })
  25. }