sessions: the WSL tests wait for the distro's first listing, however busy the machine

TestWSLAgentsGoneListingDrops went red in a run of internal/sessions on
mica at load ~48: "answered=true: want 7 sessions, got 0". The first
List waits at most wslFirstWait (3s) for the WSL walk, as the Sessions
page should, and on a busy machine the walk outlasts it, so the count
read nothing yet. Every test built on wslDistro counts that first
listing (TestWSLSessionsListed, the Antigravity and Kimi WSL tests), so
wslDistro now gives it a minute; TestWSLFirstWaitIsWaitedOnce still sets
its own 500ms after.

Broken by hand: a 3.5s stall in WSLHomes gave the same red, "got 0",
without this change and passed with it (mica-run, -run
TestWSLAgentsGoneListingDrops). Alone, unstalled, the test passed 5 of
5 on the old and new code.

Run: on mica (mica-run): go test -count=1 -run 'WSL|Antigravity|Agy|Gone'
./internal/sessions ok; gofmt clean. The full internal/sessions run
where it went red is in the next commit's record.
This commit is contained in:
yetone
2026-11-18 18:55:46 +08:00
parent d747549700
commit 65c9a2e411
+5
View File
@@ -34,6 +34,11 @@ func wslDistro(t *testing.T) (home string, running *bool) {
on := true
WSLHomes = func() []WSLHome { return []WSLHome{{Distro: "Ubuntu", Home: home, Running: on}} }
t.Cleanup(func() { wslSettle(); WSLHomes = nil; Reset() })
// the tests read what the first listing found: on a busy machine the
// walk outlasts the 3s a page waits for it, and the count read 0
was := wslFirstWait
wslFirstWait = time.Minute
t.Cleanup(func() { wslFirstWait = was })
Reset()
return home, &on
}