Make UnrootedConnectionsGetRemovedFromHeartbeat test less flaky (#1727)
This commit is contained in:
parent
d0743806d8
commit
bebba2a113
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
public class FrameConnectionManagerTests
|
public class FrameConnectionManagerTests
|
||||||
{
|
{
|
||||||
[Fact(Skip = "Flaky test")]
|
[Fact]
|
||||||
public void UnrootedConnectionsGetRemovedFromHeartbeat()
|
public void UnrootedConnectionsGetRemovedFromHeartbeat()
|
||||||
{
|
{
|
||||||
var connectionId = "0";
|
var connectionId = "0";
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
};
|
};
|
||||||
|
|
||||||
// The FrameConnection constructor adds itself to the connection manager.
|
// The FrameConnection constructor adds itself to the connection manager.
|
||||||
var ignore = new FrameConnection(new FrameConnectionContext
|
var frameConnection = new FrameConnection(new FrameConnectionContext
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionId = connectionId
|
ConnectionId = connectionId
|
||||||
|
|
@ -56,6 +56,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
|
|
||||||
Assert.Equal(1, connectionCount);
|
Assert.Equal(1, connectionCount);
|
||||||
trace.Verify(t => t.ApplicationNeverCompleted(connectionId), Times.Never());
|
trace.Verify(t => t.ApplicationNeverCompleted(connectionId), Times.Never());
|
||||||
|
|
||||||
|
// Ensure frameConnection doesn't get GC'd before this point.
|
||||||
|
GC.KeepAlive(frameConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue