Repository navigation
test: Change the file size in the override retry test so the poller sees the malformed write - #576
Open
kinyoklion wants to merge 1 commit into
Open
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
…ees the malformed write The initial and malformed contents had the same size. Where file times are coarse, as on Windows, both writes can share a modification time, so the poller saw no change, nothing was logged, and the test timed out. The initial content now has a different size.
3 of 4 tasks
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.
Requirements
async_*siblings (or N/A). N/A: a test-only change to the file override source tests.Related issues
test_source_retries_a_failed_load_without_a_change_signalfailed onwindows (3.10)in the CI of #572, withAssertionError: the load failure was not logged. The test passed on every other Windows and Linux version.Describe the solution you've provided
The test writes valid content, then malformed content, then fixed content. The fixed content keeps the malformed content's size and modification time, so that only the automatic retry can recover. The initial content had that same size too. The poller compares a file's modification time and size. Where file times are coarse, as on Windows, the initial and malformed writes can share a modification time, so the poller saw no change. Nothing was then logged, and the test timed out.
The initial content now has a different size from the malformed content, so the poller always sees the malformed write. The part of the test that depends on an unchanged size and time is unchanged.
To confirm the cause, I patched
_observeto round modification times down to whole seconds and ran the test. It failed after its 10-second timeout without this change, and it passes with it. The whole test file passes normally (72 tests), andisortandpycodestyleare clean.Describe alternatives you've considered
Setting the file's modification time after the malformed write. Changing the size states the intent in the content itself, and needs no extra system call.
Additional context
This merges cleanly with #574, which adds tests to the same file.
Opened from termag
Note
Overview
Stabilizes
test_source_retries_a_failed_load_without_a_change_signalon Windows by changing the initial override JSON so its file size differs from the later malformed payload.The test still relies on malformed and fixed content having the same length and mtime so recovery must come from automatic retry, not polling. On platforms with coarse mtimes, the old initial content could match the malformed write on size and time, so the poller missed the bad edit and the expected load-failure log never appeared. Comments were added to document that intent.
Reviewed by Cursor Bugbot for commit 0d9ba1c. Bugbot is set up for automated code reviews on this repo. Configure here.