test: run EVAL timeout tests under testing/synctest#128
Merged
Conversation
Wrap the context-deadline tests (TestContextTimeoutFiresOnTime, TestContextNoTimeout, the two future variants, TestTimeoutOnTryCatch) in synctest.Test so the time package uses a fake clock: deadlines fire deterministically (no wall-clock jitter) and instantly (no real wait). This lets TestTimeoutOnTryCatch drop back to a tight 500ms deadline — the value that was flaky under the real clock and which an earlier commit had widened to 2s to paper over the jitter. Verified 30x under full CPU load, all green, with and without -tags debugger. Also drops the redundant concurrent.Load setup in the future tests (newEnv already loads it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps the EVAL context-deadline tests in
synctest.Test(Go 1.25+): inside the bubble thetimepackage uses a fake clock that only advances when every goroutine is durably blocked, so deadlines fire deterministically (no wall-clock jitter) and instantly (no real wait).Converted:
TestContextTimeoutFiresOnTime,TestContextNoTimeout,TestFutureContextTimeoutFiresOnTime,TestFutureContextNoTimeout,TestTimeoutOnTryCatch.The headline win:
TestTimeoutOnTryCatchgoes back to a tight 500ms deadline — the value that was flaky under the real clock, which an earlier commit had widened to 2s to mask the jitter. Under the fake clock thecatchhandler runs at zero fake time, so the timeout is caught deterministically. Also drops the redundantconcurrent.Loadsetup in the future tests (newEnvalready loads it), which was building an env the test then didn't use.Test plan
-tags debugger(the debugger build activates the EVAL hook path; synctest still works).🤖 Generated with Claude Code