Stabilize StreamAsyncCanBeCanceledThroughGetAsyncEnumerator test (#9174)

This commit is contained in:
Mikael Mengistu 2019-04-08 15:58:15 -07:00 committed by GitHub
parent 8bfbc4a2ac
commit 1a259fb49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -449,7 +449,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
var cts = new CancellationTokenSource();
var stream = connection.StreamAsync<int>("Stream", 5, cts.Token);
var stream = connection.StreamAsync<int>("Stream", 1000, cts.Token);
var results = new List<int>();
var enumerator = stream.GetAsyncEnumerator();
@ -462,8 +462,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
}
});
Assert.Single(results);
Assert.Equal(0, results[0]);
Assert.True(results.Count > 0 && results.Count < 1000);
}
catch (Exception ex)
{
@ -665,7 +664,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
[Theory]
[MemberData(nameof(HubProtocolsAndTransportsAndHubPaths))]
[LogLevel(LogLevel.Trace)]
public async Task StreamAsyncCanBeCanceledThroughGetEnumerator(string protocolName, HttpTransportType transportType, string path)
public async Task StreamAsyncCanBeCanceledThroughGetAsyncEnumerator(string protocolName, HttpTransportType transportType, string path)
{
var protocol = HubProtocols[protocolName];
using (StartServer<Startup>(out var server))
@ -674,7 +673,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
try
{
await connection.StartAsync().OrTimeout();
var stream = connection.StreamAsync<int>("Stream", 5 );
var stream = connection.StreamAsync<int>("Stream", 1000 );
var results = new List<int>();
var cts = new CancellationTokenSource();
@ -689,8 +688,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
}
});
Assert.Single(results);
Assert.Equal(0, results[0]);
Assert.True(results.Count > 0 && results.Count < 1000);
}
catch (Exception ex)
{