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.
This commit is contained in:
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user