From 333586d73575e7882556461c022d36c77fb35895 Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Mon, 16 Apr 2018 15:26:36 -0700 Subject: [PATCH] Clean up flaky MaxRequestBufferSize tests #2225 --- .../MaxRequestBufferSizeTests.cs | 14 -------------- test/shared/PassThroughConnectionAdapter.cs | 3 ++- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/test/Kestrel.FunctionalTests/MaxRequestBufferSizeTests.cs b/test/Kestrel.FunctionalTests/MaxRequestBufferSizeTests.cs index 93919845ea..f4b8db2168 100644 --- a/test/Kestrel.FunctionalTests/MaxRequestBufferSizeTests.cs +++ b/test/Kestrel.FunctionalTests/MaxRequestBufferSizeTests.cs @@ -86,9 +86,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests var bytesWrittenPollingInterval = TimeSpan.FromMilliseconds(bytesWrittenTimeout.TotalMilliseconds / 10); var maxSendSize = 4096; - // Initialize data with random bytes - (new Random()).NextBytes(data); - var startReadingRequestBody = new TaskCompletionSource(); var clientFinishedSendingRequestBody = new TaskCompletionSource(); var lastBytesWritten = DateTime.MaxValue; @@ -300,17 +297,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests return; } - // Verify bytes received match expectedBody - for (int i = 0; i < expectedBody.Length; i++) - { - if (buffer[i] != expectedBody[i]) - { - context.Response.StatusCode = StatusCodes.Status500InternalServerError; - await context.Response.WriteAsync($"Bytes received do not match expectedBody at position {i}"); - return; - } - } - await context.Response.WriteAsync($"bytesRead: {bytesRead.ToString()}"); })) .Build(); diff --git a/test/shared/PassThroughConnectionAdapter.cs b/test/shared/PassThroughConnectionAdapter.cs index 5f10736595..b5fc3a0557 100644 --- a/test/shared/PassThroughConnectionAdapter.cs +++ b/test/shared/PassThroughConnectionAdapter.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal; +using Microsoft.Extensions.Logging.Abstractions; namespace Microsoft.AspNetCore.Testing { @@ -13,7 +14,7 @@ namespace Microsoft.AspNetCore.Testing public Task OnConnectionAsync(ConnectionAdapterContext context) { - var adapted = new AdaptedConnection(new LoggingStream(context.ConnectionStream, new TestApplicationErrorLogger())); + var adapted = new AdaptedConnection(new LoggingStream(context.ConnectionStream, NullLogger.Instance)); return Task.FromResult(adapted); }