From ac8b2cd44ea3c6a50058e06fcd80b41a1e60b250 Mon Sep 17 00:00:00 2001 From: Zhuoming Wang Date: Tue, 3 Nov 2026 21:02:32 +0800 Subject: [PATCH] test(events): use t.Context() in stream error tests forbidigo rejects context.Background() in tests; t.Context() is the intended replacement and carries the test's cancellation. Signed-off-by: Zhuoming Wang --- internal/inspect/events_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/inspect/events_test.go b/internal/inspect/events_test.go index 0aa34c28e..4ac99c111 100644 --- a/internal/inspect/events_test.go +++ b/internal/inspect/events_test.go @@ -17,7 +17,6 @@ package inspect import ( - "context" "errors" "io" "testing" @@ -42,7 +41,7 @@ func TestEventsTreatsEOFAsCompletion(t *testing.T) { }) service := New(&fakeBackend{apiClient: apiClient}) - err := service.Events(context.Background(), "project", api.EventsOptions{ + err := service.Events(t.Context(), "project", api.EventsOptions{ Consumer: func(api.Event) error { return nil }, }) @@ -61,7 +60,7 @@ func TestEventsPropagatesStreamErrors(t *testing.T) { }) service := New(&fakeBackend{apiClient: apiClient}) - err := service.Events(context.Background(), "project", api.EventsOptions{ + err := service.Events(t.Context(), "project", api.EventsOptions{ Consumer: func(api.Event) error { return nil }, })