test(auth): run the outage tests on a paused clock without sockets - #4527
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Outcome: the quest is done and this PR stays a draft for review. Open decisions:
Suggested follow-ups:
(Written by Claude Opus 5.5) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I added the moq-tokio websocket paused-clock tests to I also looked into whether
If a real consumer appears, for example running the reference
(Written by Claude Opus 5.5) |
|
Warning Review limit reachedNext included review available in 34 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ev/moq into pr-4527-merge # Conflicts: # quest/m1/README.md
Problem
#4244 and #4291 moved the relay and moq-auth outage tests to the real clock, because a paused clock auto-advances while the runtime waits on a real socket and a virtual timer fired before macOS delivered loopback. That broke "unit tests mock time", added ~3s of wall time each, and dropped the upper bound: a session that closed late at
expireswould pass.Approach
Take the sockets out of both tests, and give each one assertion.
an_outage_keeps_the_grant_until_expires): the lease driver talks to a privatePosttrait.Clientimplements it over HTTP, and the tests use an in-processScriptthat logs requests and answers directly. Validation moved out of the HTTP path into a sharedask, so both answer sources are held to the same grant contract. The test runs on the paused clock, answers re-checks as an outage, and asserts both bounds: still live atexpires - 1ms, closed asExpiredbyexpires + 1ms,endreported asExpired. The wall-clockexpiresis bracketed aroundconnect, since the driver maps it onto Tokio's clock there. It folds ina_grant_closes_at_its_expiry, which checked the same bounds without re-checks.an_expired_grant_is_refusedandexpiry_fires_while_a_recheck_is_stalledmove ontoScripttoo, and the axum-on-paused-clockclock_serverhelper is gone.an_outage_keeps_the_session_until_expires): the outage semantics now belong to moq-auth, so the relay test only proves that a lease reachingexpirescloses the session and reports the end. An embedded decider grants a lease and then never answers again, which looks like an outage to the relay.superviseholds amoq_net::Sessionover qmux on atokio::io::duplex. On the paused clock the test asserts both bounds and checks that the decider seesExpired. No new API was needed:Auth::embedded,Auth::admit, andsuperviseare already public.Each test now takes about 0.1s instead of about 3s.
Verification
--stress-count 300, with ayespinning each of the 32 cores (load average was already about 31). 300/300 passed. This was Linux only; no macOS host was available, but no socket is left for macOS to deliver late.just check: clippy and the 565 affected tests pass.quest checkfails onmainfor an unrelated reason:quest/m2/ts-import-health.mdlinks the finished/quest/m1/srt-import-stats.md.Impact
Postis private tomoq-auth::client.Follow-ups
fixed_addresses_keep_tls_name_and_request_hostandipv6_literal_fixed_addresses(moq-tokio websocket) still pause the clock over a real TLS dial. They are safe until a timeout lands on that path. They exercise real DNS/TLS/Host handling, so there was no cheap seam here.srt-import-statslink inquest/m2/ts-import-health.md.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code