Skip to content

Fix flaky FileWatcher event assertions - #55620

Merged
marcpopMSFT merged 1 commit into
mainfrom
marcpopmsft-burn-test-debt
Aug 6, 2026
Merged

marcpopMSFT merged 1 commit into
mainfrom
marcpopmsft-burn-test-debt

Conversation

@marcpopMSFT

Copy link
Copy Markdown
Member

Summary

Restore subset-based matching in FileWatcherTests.TestOperation so 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.cs from an older branch and removed this behavior, which had originally been added to stabilize platform-specific file watcher notifications. On macOS, NewFileInNewDirectory can report the expected Add and Update notifications in either order.

Fixes #55357

Testing

  • FileWatcherTests.NewFileInNewDirectory: 4 passed
  • All FileWatcherTests: 25 passed

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]>
Copilot AI review requested due to automatic review settings August 5, 2026 22:23
@marcpopMSFT
marcpopMSFT requested review from a team and tmat as code owners August 5, 2026 22:23
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TestOperation completion logic from “observed count == expected count” to “expected events are a subset of observed events”.
  • Adds a guard to ensure expectedChanges contains no duplicates (since matching is set-based).
  • Improves failure diagnostics by reporting missing expected events and listing all observed events.

@marcpopMSFT

Copy link
Copy Markdown
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.

@marcpopMSFT
marcpopMSFT merged commit de84823 into main Aug 6, 2026
23 checks passed
@marcpopMSFT
marcpopMSFT deleted the marcpopmsft-burn-test-debt branch August 6, 2026 00:00
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants