-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 flaky tests in WindowsServiceLifetimeTests #105666
Conversation
src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceLifetimeTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me. Make sure you run the impacted tests in case they don't run in normal PR validation.
Ran a few times locally in admin command prompt + Windows:
|
Merging; Buyaa out |
ServiceCanStopItself
test fails withSystem.ServiceProcess.TimeoutException : The operation requested for service 'ServiceCanStopItself' has not been completed within the specified time interval.
The interval is 30 milliseconds, changing it toTimeSpan.MaxValue
because the test is expected to stop eventually, it's not defined what time interval will be enough.ServiceSequenceIsCorrect
test fails because of race condition, it looksserviceTester.Stop()
started beforeserviceTester.Start()
completed. It was suggested tointroduce a synchronization primitive here and have the test wait for that to be signaled by the service
. AddedAutoResetEvent
instance that signals when windows service started completelyFixes #103262
Fixes #93194