From 38780729489caf754567f57087a6c2ca7a98acb7 Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Mon, 1 Apr 2024 11:52:15 +0200 Subject: [PATCH 1/7] debugging CI --- appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6638609c1..4813dc17a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,14 +16,15 @@ for: build_script: - echo build + - dotnet --version - dotnet build -f net8.0 -c Debug test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj - dotnet build -f net8.0 -c Debug test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj test_script: - sh: echo "Run unit tests" - - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj + - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj --blame-crash --verbosity diagnostic - sh: echo "Run integration tests" - - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj + - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj --blame-crash --verbosity diagnostic - matrix: From e10e4efa20294471a50e6c66a2df7335258709d2 Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Mon, 1 Apr 2024 12:05:17 +0200 Subject: [PATCH 2/7] apt-get --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 4813dc17a..9e122002e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,9 @@ for: matrix: only: - image: Ubuntu2204 + + install: + - sh: sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0 before_build: - sh: mkdir artifacts -p From 41a811598d06fe66315d39b1f82fec1ae2e395f3 Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Thu, 4 Apr 2024 20:54:44 +0200 Subject: [PATCH 3/7] print memory --- ...yTest_CreateShellStream_ChannelOpenThrowsException.cs | 8 +++++++- .../ServiceFactoryTest_CreateShellStream_Success.cs | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index 651f2fbc2..64fa57fe6 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -104,6 +104,12 @@ private void Act() } } + [TestInitialize] + public void Init() + { + Console.WriteLine("ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); + } + [TestMethod] public void CreateShellStreamShouldRethrowExceptionThrownByOpenOnChannelSession() { @@ -117,4 +123,4 @@ public void DisposeOnChannelSessionShouldHaveBeenInvokedOnce() _channelSessionMock.Verify(p => p.Dispose(), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index 3f2f92a7a..b40799c12 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -100,6 +100,13 @@ private void Act() _bufferSize); } + + [TestInitialize] + public void Init() + { + Console.WriteLine("ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); + } + [TestMethod] public void CreateShellStreamShouldNotReturnNull() { @@ -124,4 +131,4 @@ public void SendShellRequestShouldHaveBeenInvokedOnce() _channelSessionMock.Verify(p => p.SendShellRequest(), Times.Once); } } -} \ No newline at end of file +} From 5ae7237ff03361c8d55b8d8d5effb49a6364013f Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Thu, 4 Apr 2024 21:15:33 +0200 Subject: [PATCH 4/7] x --- appveyor.yml | 8 ++++++-- ...ryTest_CreateShellStream_ChannelOpenThrowsException.cs | 2 +- .../ServiceFactoryTest_CreateShellStream_Success.cs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9e122002e..690c73387 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,10 @@ image: services: - docker +branches: + only: + - develop + for: - matrix: @@ -25,9 +29,9 @@ for: test_script: - sh: echo "Run unit tests" - - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj --blame-crash --verbosity diagnostic + - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=detailed" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj --blame-crash - sh: echo "Run integration tests" - - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj --blame-crash --verbosity diagnostic + - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj --blame-crash - matrix: diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index 64fa57fe6..04660984d 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -107,7 +107,7 @@ private void Act() [TestInitialize] public void Init() { - Console.WriteLine("ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); + Console.WriteLine("memout ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index b40799c12..5ec326489 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -104,7 +104,7 @@ private void Act() [TestInitialize] public void Init() { - Console.WriteLine("ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); + Console.WriteLine("memout ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); } [TestMethod] From 60a4daabb5204f1a796a72765820e75efa6c2997 Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Thu, 4 Apr 2024 21:22:05 +0200 Subject: [PATCH 5/7] x --- ...yTest_CreateShellStream_ChannelOpenThrowsException.cs | 8 ++------ .../ServiceFactoryTest_CreateShellStream_Success.cs | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index 04660984d..f2c8980db 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -80,8 +80,10 @@ private void Arrange() [TestInitialize] public void Initialize() { + Console.WriteLine("memout1 ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); Arrange(); Act(); + Console.WriteLine("memout2 ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); } private void Act() @@ -104,12 +106,6 @@ private void Act() } } - [TestInitialize] - public void Init() - { - Console.WriteLine("memout ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); - } - [TestMethod] public void CreateShellStreamShouldRethrowExceptionThrownByOpenOnChannelSession() { diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index 5ec326489..55e03c342 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -84,8 +84,10 @@ private void Arrange() [TestInitialize] public void Initialize() { + Console.WriteLine("memout1 ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); Arrange(); Act(); + Console.WriteLine("memout2 ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); } private void Act() @@ -100,13 +102,6 @@ private void Act() _bufferSize); } - - [TestInitialize] - public void Init() - { - Console.WriteLine("memout ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); - } - [TestMethod] public void CreateShellStreamShouldNotReturnNull() { From e39a872b96dd3fc2e7154dca95d1c6717747dbc4 Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Thu, 4 Apr 2024 22:30:21 +0200 Subject: [PATCH 6/7] Remove some unbounded random.Next() calls Some of which are causing giant array allocations unnecessarily. Should stabilise CI. --- ...eateShellStream_ChannelOpenThrowsException.cs | 14 ++++++-------- ...ream_SendPseudoTerminalRequestReturnsFalse.cs | 16 +++++++--------- ...m_SendPseudoTerminalRequestThrowsException.cs | 16 +++++++--------- ...teShellStream_SendShellRequestReturnsFalse.cs | 16 +++++++--------- ...hellStream_SendShellRequestThrowsException.cs | 16 +++++++--------- ...rviceFactoryTest_CreateShellStream_Success.cs | 14 ++++++-------- ...erTest_Read_ReadAheadExceptionInBeginRead.cs} | 2 +- ...adExceptionInWaitOnHandle_NoChunkAvailable.cs | 2 +- ...ftpFileStreamTest_SetLength_SessionNotOpen.cs | 2 +- ...mTest_SetLength_SessionOpen_FIleAccessRead.cs | 4 ++-- ..._SetLength_SessionOpen_FIleAccessReadWrite.cs | 4 ++-- ...Test_SetLength_SessionOpen_FIleAccessWrite.cs | 4 ++-- ...ountGreatherThanTwoTimesTheWriteBufferSize.cs | 8 ++++---- 13 files changed, 53 insertions(+), 65 deletions(-) rename test/Renci.SshNet.Tests/Classes/Sftp/{SftpFileReaderTest_Read_ReahAheadExceptionInBeginRead.cs => SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs} (99%) diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index f2c8980db..62b5e90b2 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -27,15 +27,13 @@ public class ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException private void SetupData() { - var random = new Random(); - - _terminalName = random.Next().ToString(); - _columns = (uint) random.Next(); - _rows = (uint) random.Next(); - _width = (uint) random.Next(); - _height = (uint) random.Next(); + _terminalName = "test"; + _columns = 80; + _rows = 20; + _width = 300; + _height = 100; _terminalModeValues = new Dictionary(); - _bufferSize = random.Next(); + _bufferSize = 512; _channelOpenException = new SshException(); _actualException = null; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs index 362351a5f..d558b05ac 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs @@ -26,15 +26,13 @@ public class ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestRetur private void SetupData() { - var random = new Random(); - - _terminalName = random.Next().ToString(); - _columns = (uint)random.Next(); - _rows = (uint)random.Next(); - _width = (uint)random.Next(); - _height = (uint)random.Next(); + _terminalName = "test"; + _columns = 80; + _rows = 20; + _width = 300; + _height = 100; _terminalModeValues = new Dictionary(); - _bufferSize = random.Next(); + _bufferSize = 512; _actualException = null; } @@ -117,4 +115,4 @@ public void DisposeOnChannelSessionShouldHaveBeenInvokedOnce() _channelSessionMock.Verify(p => p.Dispose(), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs index 67606992a..76957b28a 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs @@ -27,15 +27,13 @@ public class ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrow private void SetupData() { - var random = new Random(); - - _terminalName = random.Next().ToString(); - _columns = (uint) random.Next(); - _rows = (uint) random.Next(); - _width = (uint) random.Next(); - _height = (uint) random.Next(); + _terminalName = "test"; + _columns = 80; + _rows = 20; + _width = 300; + _height = 100; _terminalModeValues = new Dictionary(); - _bufferSize = random.Next(); + _bufferSize = 512; _sendPseudoTerminalRequestException = new SshException(); _actualException = null; @@ -119,4 +117,4 @@ public void DisposeOnChannelSessionShouldHaveBeenInvokedOnce() _channelSessionMock.Verify(p => p.Dispose(), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs index 5a6d43871..e19ba2cbf 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs @@ -26,15 +26,13 @@ public class ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse private void SetupData() { - var random = new Random(); - - _terminalName = random.Next().ToString(); - _columns = (uint) random.Next(); - _rows = (uint) random.Next(); - _width = (uint) random.Next(); - _height = (uint) random.Next(); + _terminalName = "test"; + _columns = 80; + _rows = 20; + _width = 300; + _height = 100; _terminalModeValues = new Dictionary(); - _bufferSize = random.Next(); + _bufferSize = 512; _actualException = null; } @@ -120,4 +118,4 @@ public void DisposeOnChannelSessionShouldHaveBeenInvokedOnce() _channelSessionMock.Verify(p => p.Dispose(), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs index da9cd6be8..47a85e5df 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs @@ -27,15 +27,13 @@ public class ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsExceptio private void SetupData() { - var random = new Random(); - - _terminalName = random.Next().ToString(); - _columns = (uint) random.Next(); - _rows = (uint) random.Next(); - _width = (uint) random.Next(); - _height = (uint) random.Next(); + _terminalName = "test"; + _columns = 80; + _rows = 20; + _width = 300; + _height = 100; _terminalModeValues = new Dictionary(); - _bufferSize = random.Next(); + _bufferSize = 512; _sendShellRequestException = new SshException(); _actualException = null; } @@ -121,4 +119,4 @@ public void DisposeOnChannelSessionShouldHaveBeenInvokedOnce() _channelSessionMock.Verify(p => p.Dispose(), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index 55e03c342..55481b4be 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -26,15 +26,13 @@ public class ServiceFactoryTest_CreateShellStream_Success private void SetupData() { - var random = new Random(); - - _terminalName = random.Next().ToString(); - _columns = (uint) random.Next(); - _rows = (uint) random.Next(); - _width = (uint) random.Next(); - _height = (uint) random.Next(); + _terminalName = "test"; + _columns = 80; + _rows = 20; + _width = 300; + _height = 100; _terminalModeValues = new Dictionary(); - _bufferSize = random.Next(); + _bufferSize = 512; } private void CreateMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReahAheadExceptionInBeginRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs similarity index 99% rename from test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReahAheadExceptionInBeginRead.cs rename to test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs index 9d8092fb4..a35803e6c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReahAheadExceptionInBeginRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { [TestClass] - public class SftpFileReaderTest_Read_ReahAheadExceptionInBeginRead : SftpFileReaderTestBase + public class SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead : SftpFileReaderTestBase { private const int ChunkLength = 32 * 1024; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs index f9d605a60..12991fb42 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs @@ -29,7 +29,7 @@ protected override void SetupData() var random = new Random(); _handle = CreateByteArray(random, 5); - _fileSize = random.Next(); + _fileSize = 1234; _waitHandleArray = new WaitHandle[2]; _operationTimeout = random.Next(10000, 20000); _closeAsyncResult = new SftpCloseAsyncResult(null, null); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs index a7e707653..b4712c716 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs @@ -28,7 +28,7 @@ protected override void SetupData() _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); - _length = random.Next(); + _length = 5555; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs index e93017f53..9ed804644 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs @@ -7,7 +7,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { [TestClass] - public class SftpFileStreamTest_SetLength_SessionOpen_FIleAccess : SftpFileStreamTestBase + public class SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead : SftpFileStreamTestBase { private SftpFileStream _target; private string _path; @@ -28,7 +28,7 @@ protected override void SetupData() _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); - _length = random.Next(); + _length = 6666; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs index f18711762..a4a96eea5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs @@ -9,7 +9,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { [TestClass] - public class SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite + public class SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite { private Mock _sftpSessionMock; private string _path; @@ -46,7 +46,7 @@ protected void Arrange() _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); - _length = random.Next(); + _length = 7777; _fileAttributesLastAccessTime = DateTime.UtcNow.AddSeconds(random.Next()); _fileAttributesLastWriteTime = DateTime.UtcNow.AddSeconds(random.Next()); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs index d741ad1fd..1ac2be5ff 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs @@ -9,7 +9,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { [TestClass] - public class SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite + public class SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite { private Mock _sftpSessionMock; private string _path; @@ -46,7 +46,7 @@ protected void Arrange() _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); - _length = random.Next(); + _length = 8888; _fileAttributesLastAccessTime = DateTime.UtcNow.AddSeconds(random.Next()); _fileAttributesLastWriteTime = DateTime.UtcNow.AddSeconds(random.Next()); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs index e7d537069..229714c39 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs @@ -121,10 +121,10 @@ public void LengthShouldFlushBufferAndReturnSizeOfFile() { var lengthFileAttributes = new SftpFileAttributes(DateTime.UtcNow, DateTime.UtcNow, - _random.Next(), - _random.Next(), - _random.Next(), - (uint) _random.Next(0, int.MaxValue), + 123, + 456, + 789, + 7, null); byte[] actualFlushedData = null; From bcfc27df37b5ba7088384abf0deefa0b06611a1c Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Thu, 4 Apr 2024 22:45:47 +0200 Subject: [PATCH 7/7] cleanup --- appveyor.yml | 12 ++---------- ...t_CreateShellStream_ChannelOpenThrowsException.cs | 5 +---- ...llStream_SendPseudoTerminalRequestReturnsFalse.cs | 3 +-- ...tream_SendPseudoTerminalRequestThrowsException.cs | 3 +-- ...CreateShellStream_SendShellRequestReturnsFalse.cs | 3 +-- ...ateShellStream_SendShellRequestThrowsException.cs | 3 +-- .../ServiceFactoryTest_CreateShellStream_Success.cs | 5 +---- ...reamTest_SetLength_SessionOpen_FileAccessRead.cs} | 0 ...est_SetLength_SessionOpen_FileAccessReadWrite.cs} | 0 ...eamTest_SetLength_SessionOpen_FileAccessWrite.cs} | 0 10 files changed, 8 insertions(+), 26 deletions(-) rename test/Renci.SshNet.Tests/Classes/Sftp/{SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs => SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs} (100%) rename test/Renci.SshNet.Tests/Classes/Sftp/{SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs => SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs} (100%) rename test/Renci.SshNet.Tests/Classes/Sftp/{SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs => SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs} (100%) diff --git a/appveyor.yml b/appveyor.yml index 690c73387..6638609c1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,33 +5,25 @@ image: services: - docker -branches: - only: - - develop - for: - matrix: only: - image: Ubuntu2204 - - install: - - sh: sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0 before_build: - sh: mkdir artifacts -p build_script: - echo build - - dotnet --version - dotnet build -f net8.0 -c Debug test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj - dotnet build -f net8.0 -c Debug test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj test_script: - sh: echo "Run unit tests" - - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=detailed" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj --blame-crash + - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj - sh: echo "Run integration tests" - - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj --blame-crash + - sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj - matrix: diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index 62b5e90b2..e39991b57 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -78,10 +77,8 @@ private void Arrange() [TestInitialize] public void Initialize() { - Console.WriteLine("memout1 ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); Arrange(); Act(); - Console.WriteLine("memout2 ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException: {0:N0}", GC.GetTotalMemory(false)); } private void Act() diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs index d558b05ac..c3147d56e 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs index 76957b28a..c94b80291 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs index e19ba2cbf..97d44a93b 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs index 47a85e5df..b2ea49d38 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index 55481b4be..7cf0c62c5 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -82,10 +81,8 @@ private void Arrange() [TestInitialize] public void Initialize() { - Console.WriteLine("memout1 ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); Arrange(); Act(); - Console.WriteLine("memout2 ServiceFactoryTest_CreateShellStream_Success: {0:N0}", GC.GetTotalMemory(false)); } private void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs similarity index 100% rename from test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs rename to test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs similarity index 100% rename from test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs rename to test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs similarity index 100% rename from test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs rename to test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs