From f314362ea5d239c38a0c45e212212737b151a42b Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Tue, 28 Aug 2018 12:52:42 -0700 Subject: [PATCH] Remove logging from flaky SSE tests (#2880) --- .../package-lock.json | 2 +- clients/ts/signalr/package-lock.json | 2 +- ...HttpConnectionTests.ConnectionLifecycle.cs | 32 +++++++------------ .../ServerSentEventsTransportTests.cs | 10 ++---- 4 files changed, 16 insertions(+), 30 deletions(-) diff --git a/clients/ts/signalr-protocol-msgpack/package-lock.json b/clients/ts/signalr-protocol-msgpack/package-lock.json index 67bd814758..db929db8fd 100644 --- a/clients/ts/signalr-protocol-msgpack/package-lock.json +++ b/clients/ts/signalr-protocol-msgpack/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aspnet/signalr-protocol-msgpack", - "version": "1.1.0-preview1-t000", + "version": "1.1.0-preview2-t000", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/clients/ts/signalr/package-lock.json b/clients/ts/signalr/package-lock.json index bded6a88f4..98b74a1f68 100644 --- a/clients/ts/signalr/package-lock.json +++ b/clients/ts/signalr/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aspnet/signalr", - "version": "1.1.0-preview1-t000", + "version": "1.1.0-preview2-t000", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs index a7af19c405..b1f4eab03f 100644 --- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs +++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs @@ -326,31 +326,23 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests [Fact] public async Task SSEWontStartIfSuccessfulConnectionIsNotEstablished() { - bool ExpectedErrors(WriteContext writeContext) - { - return writeContext.LoggerName == typeof(HttpConnection).FullName && - writeContext.EventId.Name == "ErrorStartingTransport"; - } + // TODO: Add logging https://github.com/aspnet/SignalR/issues/2879 + var httpHandler = new TestHttpMessageHandler(); - using (StartVerifiableLog(out var loggerFactory, expectedErrorsFilter: ExpectedErrors)) + httpHandler.OnGet("/?id=00000000-0000-0000-0000-000000000000", (_, __) => { - var httpHandler = new TestHttpMessageHandler(); + return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.InternalServerError)); + }); - httpHandler.OnGet("/?id=00000000-0000-0000-0000-000000000000", (_, __) => + var sse = new ServerSentEventsTransport(new HttpClient(httpHandler)); + + await WithConnectionAsync( + CreateConnection(httpHandler, transport: sse), + async (connection) => { - return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.InternalServerError)); + await Assert.ThrowsAsync( + () => connection.StartAsync(TransferFormat.Text).OrTimeout()); }); - - var sse = new ServerSentEventsTransport(new HttpClient(httpHandler)); - - await WithConnectionAsync( - CreateConnection(httpHandler, loggerFactory: loggerFactory, transport: sse), - async (connection) => - { - await Assert.ThrowsAsync( - () => connection.StartAsync(TransferFormat.Text).OrTimeout()); - }); - } } [Fact] diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs index 0830678222..978f1afa09 100644 --- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs @@ -164,12 +164,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests [Fact] public async Task SSETransportStopsWithErrorIfSendingMessageFails() { - bool ExpectedErrors(WriteContext writeContext) - { - return writeContext.LoggerName == typeof(ServerSentEventsTransport).FullName && - writeContext.EventId.Name == "ErrorSending"; - } - + // TODO: Add logging https://github.com/aspnet/SignalR/issues/2879 var eventStreamTcs = new TaskCompletionSource(); var copyToAsyncTcs = new TaskCompletionSource(); @@ -198,9 +193,8 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests }); using (var httpClient = new HttpClient(mockHttpHandler.Object)) - using (StartVerifiableLog(out var loggerFactory, expectedErrorsFilter: ExpectedErrors)) { - var sseTransport = new ServerSentEventsTransport(httpClient, loggerFactory); + var sseTransport = new ServerSentEventsTransport(httpClient); await sseTransport.StartAsync( new Uri("http://fakeuri.org"), TransferFormat.Text).OrTimeout();