-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix flaky tests #13223
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 #13223
Conversation
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| await processor.StartProcessingAsync(); | ||
| var stopwatch = Stopwatch.StartNew(); | ||
| while (stopwatch.Elapsed.TotalSeconds <= 10) | ||
| while (stopwatch.Elapsed.TotalSeconds <= 30) |
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.
This seems like it may have some non-determinism due to the timings. You may want to consider setting a TaskCompletionSource in your exception handler and awaiting that here with a Task.WaitAny timeout. I'd also advise allowing for a few minutes in that timeout due to how things run in CI. (Event Hubs had some issues with shorter timeouts like this when parallelism caused a test to suspend for longer than we expected)
To illustrate, I'm thinking something like:
using var cancellationSource = new CancellationTokenSource();
cancellationSource.CancelAfter(ServiceBusTestEnvironment.Instance.TestExecutionTimeLimit);
// stuff...
await Task.WhenAny(exceptionHandlerCalledSource.Task, Task.Delay(Timeout.Infinite, cancellationSource.Token));
Assert.That(cancellationSource.IsCancellationRequested, Is.False, "The cancellation token should not have been signaled.");
cancellationSource.Cancel();
// stuff...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.
That's fair - this was copied wholesale from Track 1. If there is any more flakiness I will make this update.
Update python track2 sdk for deviceupdate (Azure#13223) * Update python track2 sdk for deviceupdate * fix
Fixes #13062