[Components][Fixes #7405] Increase CanTriggerEventHandlerDisposedInEarlierPendingBatchAsync timeout to reduce test flakyness

Increases the timeout from 500 to 1000
This commit is contained in:
Javier Calvarro Nelson 2019-02-27 04:28:07 -08:00 committed by GitHub
parent bbe4a9d071
commit 4fe4295720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -2566,8 +2566,15 @@ namespace Microsoft.AspNetCore.Components.Test
// Act/Assert 3: After we complete the first UI update in which a given
// event handler ID is disposed, we can no longer reuse that event handler ID
// From here we can't see when the async disposal is completed. Just give it plenty of time (Task.Yield isn't enough).
// There is a small chance in which the continuations from TaskCompletionSource run asynchronously.
// In that case we might not be able to see the results from RemoveEventHandlerIds as they might run asynchronously.
// For that case, we are going to queue a continuation on render1TCS.Task, include a 1s delay and await the resulting
// task to offer the best chance that we get to see the error in all cases.
var awaitableTask = render1TCS.Task.ContinueWith(_ => Task.Delay(1000)).Unwrap();
render1TCS.SetResult(null);
await Task.Delay(500); // From here we can't see when the async disposal is completed. Just give it plenty of time (Task.Yield isn't enough).
await awaitableTask;
var ex = await Assert.ThrowsAsync<ArgumentException>(() =>
{
return renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs());