Make UnrootedConnectionsGetRemovedFromHeartbeat test less flaky (#1727)

This commit is contained in:
Stephen Halter 2017-04-20 10:58:48 -07:00 committed by GitHub
parent d0743806d8
commit bebba2a113
1 changed files with 5 additions and 2 deletions

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
public class FrameConnectionManagerTests
{
[Fact(Skip = "Flaky test")]
[Fact]
public void UnrootedConnectionsGetRemovedFromHeartbeat()
{
var connectionId = "0";
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
};
// The FrameConnection constructor adds itself to the connection manager.
var ignore = new FrameConnection(new FrameConnectionContext
var frameConnection = new FrameConnection(new FrameConnectionContext
{
ServiceContext = serviceContext,
ConnectionId = connectionId
@ -56,6 +56,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
Assert.Equal(1, connectionCount);
trace.Verify(t => t.ApplicationNeverCompleted(connectionId), Times.Never());
// Ensure frameConnection doesn't get GC'd before this point.
GC.KeepAlive(frameConnection);
}
}
}