Repository navigation
test(e2e): the poll spacing check tolerates the fake Canvas's arrival delay instead of flaking - #173
Merged
Merged
Conversation
… delay instead of flaking The poller paces sends 100 ms apart on time.monotonic(), but the fake stamps each request when its handler thread wakes, so one late stamp shortened the next gap (0.064 s on PR #171). The check now asserts that no stretch of requests ran faster than the interval allows, minus one 50 ms arrival delay, which does not add up.
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.
What
test_canvasfailed on most PRs at the poll spacing check (min(gaps) >= 0.08; 0.064 s on #171 while every other gap was ~0.100 s). The poller was right. The measurement was wrong.CanvasClient._pace) paces sends ontime.monotonic(): it sleeps until_last + interval, then stamps_lastright before the request, so two sends are never closer than 100 ms.FakeCanvasstampstime.time()when the request's handler thread wakes. That adds a variable delay: thread scheduling in the busy pytest process (five E2E tests and their fakes), or a new connection after a streamed download. When request N is stamped late and N+1 is not, the measured gap shrinks to0.1 - delay.That delay is bounded and does not add up over several requests, so the check now asserts that no stretch of k gaps ran faster than k intervals, minus one 50 ms arrival delay. The #171 run passes (worst -0.036 s). A poll with no throttle still fails: any two back-to-back requests arrive about 0.1 s too early.
E2E:
test_canvaspasses.test_academicofailed on this run at step 5 (no «Conectar Académico» url button within 120 s after "actualiza mi Académico"). This change doesn't touch that test, and it may be a separate flake.Docs: none needed, test-only change.