diff --git a/main_test.go b/main_test.go index 4c5d866..9326499 100644 --- a/main_test.go +++ b/main_test.go @@ -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) } }