Skip to content

HealthTests: wait for background ops before gvfs health#2061

Open
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-flaky-health-test
Open

HealthTests: wait for background ops before gvfs health#2061
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-flaky-health-test

Conversation

@tyrielv

@tyrielv 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 <tyrielv@gmail.com>
@tyrielv tyrielv marked this pull request as ready for review July 10, 2026 18:41
@tyrielv tyrielv enabled auto-merge July 10, 2026 18:41
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.

1 participant