make ConnectShouldActivateKeepAliveIfSessionIs test less flaky (#1410)

* make ConnectShouldActivateKeepAliveIfSessionIs test less flaky

wait longer and expect at least two instead of exactly two.

example: https://ci.appveyor.com/project/drieseng/ssh-net/builds/49849877/job/9rrtw6j8eu3i5p8o?fullLog=true

* fix net462 build
This commit is contained in:
mus65
2024-05-21 13:05:46 +02:00
committed by GitHub
parent b4722b86e8
commit 7d52787ce3
@@ -69,11 +69,11 @@ namespace Renci.SshNet.Tests.Classes
_client.Connect();
// allow keep-alive to be sent twice
Thread.Sleep(250);
// allow keep-alive to be sent at least twice with some margin for error
Thread.Sleep(5 * (int)_keepAliveInterval.TotalMilliseconds);
// Exactly two keep-alives should be sent
SessionMock.Verify(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()), Times.Exactly(2));
// At least two keep-alives should be sent
SessionMock.Verify(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()), Times.AtLeast(2));
}
private class MyClient : BaseClient