Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] make Windows memory leak tests consistent #15998

Merged
merged 1 commit into from Jul 5, 2023

Conversation

jonathanpeppers
Copy link
Member

Fixes part of: #15530

These would fail randomly for me when I ran them. But after reviewing memory snapshots, I didn't find an actual issue the tests were just flaky.

I found I could rework the tests to do:

await AssertionExtensions.Wait(() =>
{
    GC.Collect();
    GC.WaitForPendingFinalizers();
    return !pageReference.IsAlive;
}, timeout: 5000);

And now they pass every time for me locally.

So, it waits up to 5 seconds, and quits early if the page is gone.

If this still passes on all platforms -- we can probably use this instead.

Fixes part of: dotnet#15530

These would fail randomly for me when I ran them. But after reviewing
memory snapshots, I didn't find an actual issue the tests were just
flaky.

I found I could rework the tests to do:

    await AssertionExtensions.Wait(() =>
    {
        GC.Collect();
        GC.WaitForPendingFinalizers();
        return !pageReference.IsAlive;
    }, timeout: 5000);

And now they pass every time for me locally.

So it waits up to 5 seconds, and quits early if the page is gone.

If this still passes on all platforms -- we should just use this
instead.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review July 5, 2023 18:44
@jonathanpeppers jonathanpeppers added the area/testing Unit tests, device tests label Jul 5, 2023
@PureWeen PureWeen merged commit bf1a9c0 into dotnet:main Jul 5, 2023
27 checks passed
@jonathanpeppers jonathanpeppers deleted the fix-windows-leak-tests branch July 5, 2023 19:26
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants