Problem
Under CPU load, TestIssue1008_HandlerReturns503WhileSubpathIndexLoading in cmd/server fails occasionally with status = 200, want 503. This was found during the #214 review, which does not touch the store or the index code.
- The test checks the not-ready window right after
Load(). That window races the background subpath index build on the test's 6-transmission fixture. When the build finishes first, the handler already returns 200.
- Measured with a pre-compiled
-race binary:
- It is a timing flake in the test, not a production bug.
Fix direction
Make the not-ready window deterministic in the test. For example, hold the subpath index build with a test hook or gate until the 503 has been asserted, then release it and assert 200. Do not rely on the build being slower than the request.
Acceptance
Problem
Under CPU load,
TestIssue1008_HandlerReturns503WhileSubpathIndexLoadingincmd/serverfails occasionally withstatus = 200, want 503. This was found during the #214 review, which does not touch the store or the index code.Load(). That window races the background subpath index build on the test's 6-transmission fixture. When the build finishes first, the handler already returns 200.-racebinary:Fix direction
Make the not-ready window deterministic in the test. For example, hold the subpath index build with a test hook or gate until the 503 has been asserted, then release it and assert 200. Do not rely on the build being slower than the request.
Acceptance
go test -race -count=200 -run TestIssue1008_HandlerReturns503WhileSubpathIndexLoading ./cmd/server/passes under parallel CPU load (e.g. alongside anothergo test -racerun).