From 9bc9a6e5e1d6adadbee0d1ddffd1067df0dbeee5 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 14 Oct 2026 18:41:40 +0800 Subject: [PATCH] tests: TestRefreshInvalidationCancelsStaleCall gives the second ask 10s, not 1s, so a loaded runner doesn't read it as a stale listing left running Seen red during a full run at load average 200-360 ("stale listing was not cancelled and followed by the new state", 1.73s). The test's fake first ask waits on its context alone, so a listing that invalidation fails to cancel never ends; a 1s bound only measured how fast the second ask and the commit ran. 10s keeps that apart with room on both sides. Run: a 1.5s sleep injected into the second ask fails the old 1s bound with the same message and passes the 10s one; with provCancel() taken out of forgetProviders the test still fails (Fatal at 10s, then the package times out on Settle, as before). go test -race -count=20 -run the test, go test -tags nogui ./internal/plugin (179s), gofmt -l, go vet darwin, GOOS=linux -tags nogui and GOOS=windows on ./internal/plugin pass. Test-only change; ./... not run. TestRefreshDeadlineBoundsRealProviderCall in the same file still bounds a 100ms deadline against a 1.5s plugin call with a 1s wait (900ms/500ms of room); not changed here. --- internal/plugin/providers_refresh_deadline_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/plugin/providers_refresh_deadline_test.go b/internal/plugin/providers_refresh_deadline_test.go index e1bcc0791..c71746a3b 100644 --- a/internal/plugin/providers_refresh_deadline_test.go +++ b/internal/plugin/providers_refresh_deadline_test.go @@ -370,9 +370,12 @@ func TestRefreshInvalidationCancelsStaleCall(t *testing.T) { Cached() done := make(chan struct{}) go func() { Refreshed(); close(done) }() + // a stale listing left uncancelled never ends (this ask waits on its + // context alone), so 10s tells that apart and leaves a loaded runner + // room for the second ask select { case <-done: - case <-time.After(time.Second): + case <-time.After(10 * time.Second): t.Fatal("stale listing was not cancelled and followed by the new state") } if asks.Load() != 2 || !refreshCacheGood() || Cached()[0].Name != "Recovered" {