File size: 488 Bytes
e48a2d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | package main
import "testing"
func TestBudgetAndJitterRejectBadValues(t *testing.T) {
c := Default()
c.Budget.DailyCreditLimit = -1
if err := c.normalize(); err == nil {
t.Fatal("negative budget should fail")
}
c = Default()
c.Schedule.JitterMinutes = 1441
if err := c.normalize(); err == nil {
t.Fatal("jitter over a day should fail")
}
c = Default()
c.Alerting.Enabled = true
if err := c.normalize(); err == nil {
t.Fatal("alerting without webhook should fail")
}
}
|