Przeglądaj źródła

fix flaky ReceiveOnServerSocketShouldReturnZero test (#1404)

* fix flaky ReceiveOnServerSocketShouldReturnZero test

ReceiveOnServerSocketShouldReturnZero assumed that the disconnect
already happened on the server side, but it never waits for this.
This could cause ServerSocket.Receive to still return valid data
and fail the test.

example: https://ci.appveyor.com/project/drieseng/ssh-net/builds/49836561/job/wen5tjd1c7wgxrfh

* Update test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
mus65 1 rok temu
rodzic
commit
fcb4ea2a1b

+ 3 - 0
test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs

@@ -15,7 +15,10 @@ namespace Renci.SshNet.Tests.Classes
     {
         protected override void Act()
         {
+            using ManualResetEventSlim clientDisconnected = new ManualResetEventSlim(false);
+            ServerListener.Disconnected += (socket) => clientDisconnected.Set();
             Session.Disconnect();
+            clientDisconnected.Wait(10000);
         }
 
         [TestMethod]