Skip to content

HealthTests: wait for background ops before gvfs health - #2061

Merged
Tyrie Vella (tyrielv) merged 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-flaky-health-test
Jul 14, 2026
Merged

Tyrie Vella (tyrielv) merged 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-flaky-health-test

Conversation

@tyrielv

@tyrielv Tyrie Vella (tyrielv) commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

HealthTests read placeholder/modified-path counts via gvfs health immediately after hydrating files via File.OpenWrite(). Those writes trigger ProjFS callbacks that GVFS processes on a background queue, so the modified-paths database may not yet reflect the full set of transitions when the health verb samples it.

Root cause

The race manifests as: fast-file count is still 5 (some Scripts/*.bat entries still counted as placeholders) when the test expects 3 after TurnPlaceholdersIntoModifiedPaths.

Fix

Call WaitForBackgroundOperations() in ValidateHealthOutputValues before invoking the health verb, consistent with every other functional test that asserts modified-path state after a file operation (e.g. GitFilesTests, ModifiedPathsTests, CheckoutTests).

Testing

  • GVFS.FunctionalTests project builds clean (dotnet build ... -c Debug).
  • Fix mirrors the existing pattern used by all other functional tests that assert modified-path state.

HealthTests read placeholder/modified-path counts via 'gvfs health'
immediately after hydrating files via File.OpenWrite().  Those writes
trigger ProjFS callbacks that GVFS processes on a background queue, so
the modified-paths database may not yet reflect the full set of
transitions when the health verb samples it.

The resulting race manifests as: fast-file count is still 5 (some
Scripts/*.bat entries still counted as placeholders) when the test
expects 3 after TurnPlaceholdersIntoModifiedPaths.

Fix: call WaitForBackgroundOperations() in ValidateHealthOutputValues
before invoking the health verb, consistent with every other functional
test that asserts modified-path state after a file operation (e.g.
GitFilesTests, ModifiedPathsTests, CheckoutTests).

Assisted-by: Claude Sonnet 4.6
Signed-off-by: Tyrie Vella <[email protected]>
@tyrielv
Tyrie Vella (tyrielv) marked this pull request as ready for review July 10, 2026 18:41
@tyrielv
Tyrie Vella (tyrielv) merged commit a010c24 into microsoft:master Jul 14, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants