-
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 TestsManifestGeneration tests #46658
Conversation
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue DetailsFix #46518 These tests sometimes fail because the call to disable the provider or roll over the file happens almost instantly after TraceEventSession.Flush(), and the Manifest data may not have been fully written to the file before we check for its existence. This adds a sleep between flushing and disabling the provider so that there's plenty of leeway for the payload to be fully written to the trace file.
|
...braries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs
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.
I don't like adding sleeps in tests, but that seems to be the pattern for this test already and as you've pointed out, we need to wait here anyway. Can you decorate the sleep calls you're adding with comments for why they are "necessary"?
Coming to this late, but could you not use the pattern of using a nominal (or no) sleep, doing the test, and if it fails, doing the longer sleep and testing again? This is the pattern we use many other places. Per the test history, we know that in the 99% case this sleep is not necessary. With the change as is, the tests all take longer to run, it's not a situation we want to be in. |
@danmosemsft thanks for the suggestion. So these sleeps were removed in a subsequent PR that addressed more issues on the test... But yes, I agree and I think we need to come up with a better synchronization mechanisms for the tracing tests as many of them are timing sensitive. |
Fix #46518
These tests sometimes fail because the call to disable the provider or roll over the file happens almost instantly after TraceEventSession.Flush(), and the Manifest data may not have been fully written to the file before we check for its existence. This adds a sleep between flushing and disabling the provider so that there's plenty of leeway for the payload to be fully written to the trace file.