Repository navigation
Fix flaky FileWatcher event assertions - #55620
Merged
Merged
Conversation
Restore subset-based event matching so OS notifications may arrive in any order and unrelated extra events do not end the wait early.\n\nFixes #55357\n\nCo-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR stabilizes dotnet-watch file watcher tests by restoring subset-based matching for expected file-system events, so tests don’t depend on OS-specific event ordering and aren’t completed early by unrelated extra notifications.
Changes:
- Switches
TestOperationcompletion logic from “observed count == expected count” to “expected events are a subset of observed events”. - Adds a guard to ensure
expectedChangescontains no duplicates (since matching is set-based). - Improves failure diagnostics by reporting missing expected events and listing all observed events.
tmat
approved these changes
Aug 5, 2026
Member
Author
|
I created a local automation to run weekly that is looking through our known failure issues and test debt issues looking for easy to fix issues. This was the trial run of it. I hope that for the coming weeks, it finds more obvious wins like this one seems to be. I'm not as familiar with this test but if tmat signs off, I think we're good to go here as the reasoning is sound. |
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.
Summary
Restore subset-based matching in
FileWatcherTests.TestOperationso expected file-system events can arrive in any order and unrelated extra OS events do not complete the wait early.An unrelated backport in #55483 recreated
FileWatcherTests.csfrom an older branch and removed this behavior, which had originally been added to stabilize platform-specific file watcher notifications. On macOS,NewFileInNewDirectorycan report the expectedAddandUpdatenotifications in either order.Fixes #55357
Testing
FileWatcherTests.NewFileInNewDirectory: 4 passedFileWatcherTests: 25 passed