Fix flaky test (#3268)

This commit is contained in:
BrennanConroy 2018-11-08 11:47:26 -08:00 committed by GitHub
parent f4d3ebe09a
commit d0dac557ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -359,8 +359,16 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
[MemberData(nameof(HubProtocolsAndTransportsAndHubPaths))]
public async Task CanCloseStreamMethodEarly(string protocolName, HttpTransportType transportType, string path)
{
bool ExpectedErrors(WriteContext writeContext)
{
// Writing is not allowed after writer was completed.
// Can happen since we are closing the connection while the connection could still be writing the streaming data
return writeContext.LoggerName == typeof(HubConnectionContext).FullName &&
writeContext.EventId.Name == "FailedWritingMessage";
}
var protocol = HubProtocols[protocolName];
using (StartServer<Startup>(out var loggerFactory, out var fixture, LogLevel.Trace, $"{nameof(CanCloseStreamMethodEarly)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
using (StartServer<Startup>(out var loggerFactory, out var fixture, LogLevel.Trace, $"{nameof(CanCloseStreamMethodEarly)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}", ExpectedErrors))
{
var connection = CreateHubConnection(fixture.Url, path, transportType, protocol, loggerFactory);
try