Skip to content

Conversation

GangWang01
Copy link
Member

Fixes #9298

Context

Waiting using Thread.Sleep(500) in the test is unreliable.

Changes Made

Wait until the specified log appears rather than Thread.Sleep(500).

Testing

Notes

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

Looks as a good way to get rid of some of the pesky flakyness - great!

I'd love to see the test to not iterate the log events repetitively. We can use MockLogger to avoid the additional thread/task and 'wake-check-sleep' pattern here

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

Thank you!

@GangWang01 GangWang01 merged commit 08494c7 into dotnet:main Oct 23, 2023
@GangWang01 GangWang01 deleted the flakytest9298 branch October 23, 2023 01:54
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.

[Bug] [Flaky test]: CanceledTasksDoNotLogMSB4181 unit test is unreliable

3 participants