Skip to content

Commit 51e0c67

Browse files
authored
Try to "fix" the flaky test (#1185)
1 parent aade354 commit 51e0c67

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ public void ForwardedPortShouldAcceptNewConnections()
139139
new ForwardedTcpipChannelInfo(_forwardedPort.BoundHost, _forwardedPort.BoundPort, originatorAddress,
140140
originatorPort))));
141141

142+
// CreateChannelForwardedTcpip gets called on a separate thread.
143+
// Sleep on this thread briefly to avoid a race.
144+
Thread.Sleep(500);
145+
142146
_sessionMock.Verify(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize), Times.Once);
143147
channelMock.Verify(p => p.Bind(It.Is<IPEndPoint>(ep => ep.Address.Equals(_remoteEndpoint.Address) && ep.Port == _remoteEndpoint.Port), _forwardedPort), Times.Once);
144148
channelMock.Verify(p => p.Dispose(), Times.Once);

0 commit comments

Comments
 (0)