timeout main

This commit is contained in:
Bel LaPointe
2025-04-24 21:12:50 -06:00
parent a174e6834d
commit d14d73bf91

View File

@@ -6,13 +6,17 @@ import (
"show-rss/src/cmd"
"syscall"
"testing"
"time"
)
func TestCmdMain(t *testing.T) {
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
defer can()
if err := cmd.Main(ctx); err != nil {
ctx, can = context.WithTimeout(ctx, 5*time.Second)
defer can()
if err := cmd.Main(ctx); err != nil && ctx.Err() == nil {
t.Fatal(err)
}
}