feat(orchestrator): thread run trigger; breaker on scheduled runs with errors
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package orchestrator
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestShouldBreak(t *testing.T) {
|
||||
cases := []struct {
|
||||
trigger string
|
||||
errs int64
|
||||
want bool
|
||||
}{
|
||||
{"scheduled", 2, true}, // scheduled run with errors trips the breaker
|
||||
{"scheduled", 0, false}, // scheduled run, clean — no break
|
||||
{"manual", 5, false}, // manual run never trips the breaker
|
||||
{"manual", 0, false},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := shouldBreak(c.trigger, c.errs); got != c.want {
|
||||
t.Fatalf("shouldBreak(%q,%d)=%v want %v", c.trigger, c.errs, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user