(new): v1.2 release
Golang lint / lint (push) Successful in 11m32s

This commit is contained in:
2026-08-19 14:58:25 +03:00
parent f03a081ed6
commit 29b208eeec
79 changed files with 7301 additions and 2060 deletions
+31
View File
@@ -122,3 +122,34 @@ func TestExecRunnersRecoversRunnerPanic(t *testing.T) {
t.Fatalf("expected recovered panic in error event, got %#v", observer.errors)
}
}
func TestContextRunnerStopsActiveCallbackOnCancel(t *testing.T) {
started := make(chan struct{})
stopped := make(chan struct{})
ctx, cancel := context.WithCancel(context.Background())
bot := &Bot[NoData]{
logger: sneklog.NewLogger(),
runners: []Runner[NoData]{
NewContextRunner("cancelable", func(ctx context.Context, _ *Bot[NoData]) error {
close(started)
<-ctx.Done()
close(stopped)
return ctx.Err()
}),
},
}
bot.ExecRunners(ctx)
select {
case <-started:
case <-time.After(time.Second):
t.Fatal("context runner did not start")
}
cancel()
bot.runnerOnceWG.Wait()
select {
case <-stopped:
default:
t.Fatal("context runner did not observe cancellation")
}
}