feat(orchestrator): thread run trigger; breaker on scheduled runs with errors

This commit is contained in:
2026-07-03 13:08:21 +07:00
parent b9421d388c
commit be777dc908
3 changed files with 38 additions and 5 deletions
+21
View File
@@ -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)
}
}
}