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

Fix random test failures and add empty dispatcher verification to tests #17628

Merged
merged 3 commits into from
Nov 30, 2024

Conversation

MrJul
Copy link
Member

@MrJul MrJul commented Nov 27, 2024

What does the pull request do?

This PR fixes random test failures caused by new tests added in #17570. Those tests weren't properly isolated (which should be done using ScopedTestsBase or UnitTestApplication.Start()), pushing some jobs to the dispatcher which were executed from another unrelated test, causing it to fail.

This is a very common situation, which is hard to diagnose: it depends on the tests order and when the dispatcher effectively ran jobs.

To better handle this condition, this PR adds a new VerifyEmptyDispatcherAfterTestAttribute which checks that no pending jobs remain on the dispatcher after a test. It's applied on the assembly directly, which required an update of xUnit to work. As a result, several other test classes have been fixed.

Timeouts have been removed from xUnit synchronous headless tests, since they never worked in the first place, and result in errors after the xUnit update.

@MrJul MrJul added bug area-infrastructure Issues related to CI/tooling infrastructur labels Nov 27, 2024
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0053594-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 merged commit 1583de3 into AvaloniaUI:master Nov 30, 2024
11 checks passed
@maxkatz6 maxkatz6 added the backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch label Nov 30, 2024
maxkatz6 pushed a commit that referenced this pull request Dec 19, 2024
…ts (#17628)

* Add VerifyEmptyDispatcherAfterTestAttribute

* Use VerifyEmptyDispatcherAfterTest and fix failing tests

* Remove unsupported timeout from sync xUnit tests
@maxkatz6 maxkatz6 added backported-11.2.x and removed backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Dec 19, 2024
@MrJul MrJul deleted the fix/tests-failure branch December 21, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Issues related to CI/tooling infrastructur backported-11.2.x bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants