Files
magpie/docs
yetone dbe81adae6 gateway tests: TestClaudeIdleEvictionEnds fails on what keepIdle's old loop allocates, not on a 5s deadline (#1596)
d1f0576a7's child process failed the old loop by -test.timeout=5s under
GOMEMLIMIT=64MiB, with 30s for the parent. On a busy machine (load ~130
here) starting the gateway test binary and its TestMain can take a good
part of that, so the passing case had little room. Now the child runs
the keeps in a goroutine and watches TotalAlloc: past 256 MiB without
ending, it exits 2 with what it allocated. The ending loop is done in
microseconds, so its child has 4m and the parent 5m.

The rekey scenario set idleAt before keepIdle stamped it with
time.Now(); it is now set after, so on a coarse clock (Windows) the
stale run is still the oldest and the scenario still reaches the loop.

Run: on origin/main 5c9221899, -run TestClaudeIdle ./internal/gateway
green (each child ~20ms); with internal/gateway/claude_subscription.go
from 76db4c6c2 (before the fix), rekey and stale both red in ~0.5s,
"keepIdle allocated 258 MiB without ending". gofmt -l clean, GOOS=linux
and GOOS=windows go vet -tags nogui ./internal/gateway clean;
go test -tags nogui ./internal/gateway and the full suite before push.
2026-10-11 20:53:02 +08:00
..