feat: implement V2 alert center and scoped alert governance

This commit is contained in:
Yvan
2026-11-05 20:08:29 +08:00
parent f8e26c5baf
commit 999c9a6315
57 changed files with 2711 additions and 216 deletions
+13
View File
@@ -95,6 +95,19 @@ func TestRunMethodCancellationStopsRetryDelay(t *testing.T) {
}
}
func TestRunMethodCancellationWinsConcurrentAttemptFailure(t *testing.T) {
for i := 0; i < 32; i++ {
ctx, cancel := context.WithCancel(context.Background())
registry := platformtask.NewRegistry()
registry.Register(platformtask.Method{Name: "cancel-at-return", Run: func(context.Context, json.RawMessage) error { cancel(); return errors.New("temporary") }})
err := (&TaskExecutor{methods: registry}).runMethod(ctx, &taskbiz.TimedTask{MethodName: "cancel-at-return", Params: []byte(`{"_execution":{"maxRetryTimes":3,"retryIntervalSeconds":60}}`)})
cancel()
if !errors.Is(err, context.Canceled) {
t.Fatalf("并发取消被执行错误覆盖: %v", err)
}
}
}
func TestRunMethodUsesParentContext(t *testing.T) {
const methodName = "worker-test-parent-context"
started := make(chan struct{})