From 8a7c3b5aec2af473774652f2fc5b9f109bd4feef Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Fri, 16 Oct 2026 13:16:03 +0200 Subject: [PATCH] fix(test): mark the stale-refresh test context as an unrestricted reader #932 made ListRecommendations kick a background collection only for contexts marked via WithBackgroundCollection. #938 added stale-refresh tests with an unmarked context, so the positive control never kicks and times out, and the sentinel test passed only because of the missing marker. Both now use the marked context. Co-Authored-By: Claude Opus 5.5 --- internal/scheduler/scheduler_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/scheduler/scheduler_test.go b/internal/scheduler/scheduler_test.go index 571cbf477..b8965d14e 100644 --- a/internal/scheduler/scheduler_test.go +++ b/internal/scheduler/scheduler_test.go @@ -945,7 +945,9 @@ func TestScheduler_ListRecommendations(t *testing.T) { // returned channel and fails, which ends the refresh immediately. func staleListRecommendations(t *testing.T, staleHours int) <-chan struct{} { t.Helper() - ctx := context.Background() + // Only unrestricted readers may kick a refresh (#932); mark the context so + // the sentinel, not the missing marker, is what the zero case exercises. + ctx := WithBackgroundCollection(context.Background()) mockStore := new(MockConfigStore) old := time.Now().Add(-72 * time.Hour)