Repository navigation
Commit 69a55e5
authored
test: Change the file size in the override retry test so the poller sees the malformed write (#576)
<!-- TERMAG_PR_BODY_BEGIN -->
**Requirements**
- [x] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform
versions
- [x] Sync/async parity: matching changes made to `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_signal` failed on
`windows (3.10)` in the CI of #572, with `AssertionError: 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 `_observe` to 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), and `isort` and `pycodestyle` are 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.
<!-- TERMAG_PR_BODY_END -->
<!-- termag: box=i-0575d1c54853058d7 project=python-server-sdk -->
<sub>Opened from termag</sub>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Overview**
> Stabilizes
**`test_source_retries_a_failed_load_without_a_change_signal`** on
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.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0d9ba1c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent a1d4907 commit 69a55e5
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
530 | 533 | | |
531 | | - | |
| 534 | + | |
532 | 535 | | |
533 | 536 | | |
534 | 537 | | |
| |||
0 commit comments