Repository navigation
test: Wait for the failure status in the file synchronizer pins, so they hold on Windows - #260
Open
kinyoklion wants to merge 1 commit into
Open
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
…hey hold on Windows On Windows a rewrite with Files.write produces two file system events, and the legacy synchronizer reloads after each. The reload after the truncation reads the empty file as an empty document and delivers a change set before the malformed content is reported. The two pins that asserted the first result was the STATUS now consume results until the STATUS arrives.
This branch has not been deployed
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
Related issues
This resolves Finding 1 of the Windows stability assessment for the Java overrides work: plans/java-overrides-windows-test-stability.md in sdk-scratchpad.
It is stacked on #259, the top of the overrides stack, so the PRs below it do not change.
Describe the solution you've provided
#220 added
FileSynchronizerReloadBehaviorTest. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass:everyFailedReloadIsReportedAndLoggedAsThePlainDescriptionfailedReloadIsNotRetriedWithoutAFileChangeWhy they fail on Windows:
Files.write, which truncates the file and then writes it.WatchServicekeys, and the legacy synchronizer reloads after each.STATUS, so they received the change set instead.A new helper,
awaitStatus, consumes results until the firstSTATUSarrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still theSTATUS. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change.To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and
checkstyleTestis clean. I did not run this on Windows. java-core CI runs on Linux only.Describe alternatives you've considered
Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe.
Additional context
Not in this PR:
main, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR againstmain.main:Opened from termag
Note
Overview
Adds
awaitStatustoFileSynchronizerReloadBehaviorTestso pins wait for the firstSTATUSresult instead of the next synchronizer event. On Windows, in-place rewrites can emit a transient empty-fileCHANGE_SETbefore the malformed-load status; the helper drains intermediate results within the existing timeout.Updates
everyFailedReloadIsReportedAndLoggedAsThePlainDescriptionandfailedReloadIsNotRetriedWithoutAFileChangeto useawaitStatuswhere they assert on failed reloads. Behavior under test is unchanged on Linux; assertions align with both platforms.Reviewed by Cursor Bugbot for commit 8cda80f. Bugbot is set up for automated code reviews on this repo. Configure here.