From 13b6369aeff76011d6d494fd9a68bb9374a6e1b2 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Wed, 30 Dec 2020 14:07:58 -0800 Subject: [PATCH] fixup --- src/Servers/Kestrel/Core/test/HeartbeatTests.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Servers/Kestrel/Core/test/HeartbeatTests.cs b/src/Servers/Kestrel/Core/test/HeartbeatTests.cs index 1926cb97f1e7..49e7953715df 100644 --- a/src/Servers/Kestrel/Core/test/HeartbeatTests.cs +++ b/src/Servers/Kestrel/Core/test/HeartbeatTests.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -22,7 +23,7 @@ public void HeartbeatIntervalIsOneSecond() } [Fact] - public async Task HeartbeatTakingLongerThanIntervalIsLoggedAsError() + public async Task HeartbeatTakingLongerThanIntervalIsLoggedAsWarning() { var systemClock = new MockSystemClock(); var heartbeatHandler = new Mock(); @@ -57,11 +58,16 @@ public async Task HeartbeatTakingLongerThanIntervalIsLoggedAsError() await blockedHeartbeatTask.DefaultTimeout(); heartbeatHandler.Verify(h => h.OnHeartbeat(now), Times.Once()); - Assert.Equal($"As of\"{now}\", the heartbeat has been running for \"{heartbeatDuration}\" which is longer than \"{Heartbeat.Interval}\". This could be caused by thread pool starvation.", kestrelTrace.Logger.Messages.Single(message => message.LogLevel == LogLevel.Warning).Message); + + var warningMessage = kestrelTrace.Logger.Messages.Single(message => message.LogLevel == LogLevel.Warning).Message; + Assert.Equal($"As of \"{now.ToString(CultureInfo.InvariantCulture)}\", the heartbeat has been running for " + + $"\"{heartbeatDuration.ToString("c", CultureInfo.InvariantCulture)}\" which is longer than " + + $"\"{Heartbeat.Interval.ToString("c", CultureInfo.InvariantCulture)}\". " + + "This could be caused by thread pool starvation.", warningMessage); } [Fact] - public async Task HeartbeatTakingLongerThanIntervalIsNotLoggedAsErrorIfDebuggerAttached() + public async Task HeartbeatTakingLongerThanIntervalIsNotLoggedIfDebuggerAttached() { var systemClock = new MockSystemClock(); var heartbeatHandler = new Mock();